Merge commit 'bd947865f2881af1c52b458aa6b6b1b1844ce254' into nextRelease

Conflicts:
	ListOfContributors
	applications/solvers/compressible/sonicDyMFoam/eEqn.H
	applications/utilities/immersedBoundary/refineImmersedBoundaryMesh/Make/options
	src/coupledMatrix/coupledLduMatrix/coupledLduMatrix.C
	src/dynamicMesh/dynamicFvMesh/dynamicTopoFvMesh/coupledMesh/dynamicTopoFvMeshCoupled.C
	src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchScalarField.C
	src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C
	src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.H
	src/foam/fields/PointPatchFields/constraint/processor/ProcessorPointPatchField.C
	src/foam/interpolations/GGIInterpolation/GGIInterpolationQuickRejectTests.C
	src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.C
	src/foam/meshes/polyMesh/globalMeshData/globalMeshData.H
	src/lduSolvers/amg/coarseAmgLevel.C
	src/mesh/cfMesh/meshLibrary/utilities/octrees/meshOctree/refinementControls/objectRefinement/objectRefinement.C
This commit is contained in:
Hrvoje Jasak 2015-05-13 18:27:51 +01:00
commit 6661bc2412
214 changed files with 6713 additions and 954 deletions

View file

@ -82,5 +82,3 @@ Contents:
Niklas Wikstrom
Vanja Skuric
Alexander Vakhrushev
Inno Gatin
Alexey Matveichev

View file

@ -29,7 +29,7 @@
// Bound the energy using TMin and TMax
{
dimensionedScalar Tstd("Tstd", dimTemperature, specie::Tstd);
dimensionedScalar Tstd("Tstd", dimTemperature, specie::Tstd());
volScalarField Cv = thermo.Cv();
volScalarField R = thermo.Cp() - Cv;

View file

@ -173,7 +173,7 @@ void Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::updateCoeffs()
scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
@ -185,7 +185,7 @@ void Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::updateCoeffs()
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send

View file

@ -0,0 +1,166 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of cfMesh.
cfMesh 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.
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Creates surface patches from surface subsets
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "triSurf.H"
#include "triSurfaceCopyParts.H"
#include "demandDrivenData.H"
#include "OFstream.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void exportFeatureEdges
(
const triSurf& origSurf,
const fileName& edgeFileName
)
{
OFstream file(edgeFileName);
const pointField& points = origSurf.points();
labelList newPointLabel(points.size(), -1);
label nPoints(0);
const edgeLongList& featureEdges = origSurf.featureEdges();
forAll(featureEdges, feI)
{
const edge& e = featureEdges[feI];
if( newPointLabel[e[0]] == -1 )
newPointLabel[e[0]] = nPoints++;
if( newPointLabel[e[1]] == -1 )
newPointLabel[e[1]] = nPoints++;
}
pointField pCopy(nPoints);
forAll(newPointLabel, pI)
{
if( newPointLabel[pI] < 0 )
continue;
pCopy[newPointLabel[pI]] = points[pI];
}
//- write the header
file << "# vtk DataFile Version 3.0\n";
file << "vtk output\n";
file << "ASCII\n";
file << "DATASET POLYDATA\n";
//- write points
file << "POINTS " << pCopy.size() << " float\n";
forAll(pCopy, pI)
{
const point& p = pCopy[pI];
file << p.x() << ' ' << p.y() << ' ' << p.z() << '\n';
}
file << "\nLINES " << featureEdges.size()
<< ' ' << 3*featureEdges.size() << nl;
forAll(featureEdges, edgeI)
{
const edge& e = featureEdges[edgeI];
file << "2 " << newPointLabel[e[0]]
<< token::SPACE << newPointLabel[e[1]] << nl;
}
file << nl;
if( !file )
FatalErrorIn
(
"void exportFeatureEdges(const triSurf&, const fileName&)"
) << "Writting of feature edges failed!" << exit(FatalError);
}
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.clear();
argList::validArgs.append("input surface file");
argList::validArgs.append("output surface file");
argList::validOptions.insert("exportSubsets", "");
argList::validOptions.insert("exportFeatureEdges", "");
argList args(argc, argv);
fileName inFileName(args.args()[1]);
fileName outFileName(args.args()[2]);
fileName outFileNoExt = outFileName.lessExt();
fileName outExtension = outFileName.ext();
Info << "Out file no ext " << outFileNoExt << endl;
Info << "Extension " << outExtension << endl;
//- read the inout surface
triSurf origSurf(inFileName);
//- write the surface in the requated format
origSurf.writeSurface(outFileName);
//- export surface subsets as separate surface meshes
if( args.options().found("exportSubsets") )
{
DynList<label> subsetIDs;
origSurf.facetSubsetIndices(subsetIDs);
triSurfaceCopyParts copyParts(origSurf);
forAll(subsetIDs, subsetI)
{
//- get the name of the subset
triSurf copySurf;
wordList subsetName(1);
subsetName[0] = origSurf.facetSubsetName(subsetIDs[subsetI]);
//- create a surface mesh corresponding to the subset
copyParts.copySurface(subsetName, copySurf);
//- write the mesh on disk
fileName fName = outFileNoExt+"_facetSubset_"+subsetName[0];
fName += '.'+outExtension;
copySurf.writeSurface(fName);
}
}
if( args.options().found("exportFeatureEdges") )
{
fileName fName = outFileNoExt+"_featureEdges";
fName += ".vtk";
exportFeatureEdges(origSurf, fName);
}
Info << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -0,0 +1,3 @@
FMSToSurface.C
EXE = $(FOAM_APPBIN)/FMSToSurface

View file

@ -0,0 +1,9 @@
EXE_INC = \
-I$(FOAM_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
-I$(FOAM_SRC)/meshTools/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude
EXE_LIBS = \
-ltriSurface \
-lmeshTools \
-lmeshLibrary

View file

@ -0,0 +1,545 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of cfMesh.
cfMesh 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.
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
cfMesh utility to convert a surface file to VTK multiblock dataset
format, including the patches, feature edges and surface features.
Author
Ivor Clifford <ivor.clifford@psi.ch>
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "autoPtr.H"
#include "OFstream.H"
#include "triSurf.H"
#include "triSurfModifier.H"
#include "xmlTag.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Write the supplied pointList in serial vtkPolyData format
void writePointsToVTK
(
const fileName& fn,
const string& title,
const UList<point>& points
)
{
xmlTag xmlRoot("VTKFile");
xmlRoot.addAttribute("type", "PolyData");
xmlTag& xmlPolyData = xmlRoot.addChild("PolyData");
xmlTag& xmlPiece = xmlPolyData.addChild("Piece");
xmlPiece.addAttribute("NumberOfPoints", points.size());
xmlTag& xmlPoints = xmlPiece.addChild("Points");
xmlTag& xmlPointData = xmlPoints.addChild("DataArray");
xmlPointData.addAttribute("type", "Float32");
xmlPointData.addAttribute("NumberOfComponents", 3);
xmlPointData.addAttribute("format", "ascii");
xmlPointData << points;
OFstream os(fn);
os << xmlRoot << endl;
Info << "Created " << fn << endl;
}
//- Write the supplied addressed pointList in serial vtkPolyData format
void writePointsToVTK
(
const fileName& fn,
const string& title,
const UList<point>& points,
unallocLabelList& addr
)
{
// Create subaddressed points
pointField newPoints(addr.size());
forAll(addr, i)
{
newPoints[i] = points[addr[i]];
}
writePointsToVTK
(
fn,
title,
newPoints
);
}
//- Write the supplied edgeList in serial vtkPolyData format
void writeEdgesToVTK
(
const fileName& fn,
const string& title,
const UList<point>& points,
const LongList<edge>& edges
)
{
labelList connectivity(edges.size());
forAll(edges, edgeI)
{
connectivity[edgeI] = 2*(edgeI+1);
}
xmlTag xmlRoot("VTKFile");
xmlRoot.addAttribute("type", "PolyData");
xmlTag& xmlPolyData = xmlRoot.addChild("PolyData");
xmlTag& xmlPiece = xmlPolyData.addChild("Piece");
xmlPiece.addAttribute("NumberOfPoints", points.size());
xmlPiece.addAttribute("NumberOfLines", edges.size());
xmlTag& xmlPoints = xmlPiece.addChild("Points");
xmlTag& xmlPointData = xmlPoints.addChild("DataArray");
xmlPointData.addAttribute("type", "Float32");
xmlPointData.addAttribute("NumberOfComponents", 3);
xmlPointData.addAttribute("format", "ascii");
xmlPointData << points;
xmlTag& xmlEdges = xmlPiece.addChild("Lines");
xmlTag& xmlEdgeData = xmlEdges.addChild("DataArray");
xmlEdgeData.addAttribute("type", "Int32");
xmlEdgeData.addAttribute("Name", "connectivity");
xmlEdgeData.addAttribute("format", "ascii");
xmlEdgeData << edges;
xmlTag& xmlConnectData = xmlEdges.addChild("DataArray");
xmlConnectData.addAttribute("type", "Int32");
xmlConnectData.addAttribute("Name", "offsets");
xmlConnectData.addAttribute("format", "ascii");
xmlConnectData << connectivity;
OFstream os(fn);
os << xmlRoot << endl;
Info << "Created " << fn << endl;
}
//- Write the supplied edgeList subset in serial vtkPolyData format
void writeEdgesToVTK
(
const fileName& fn,
const string& title,
const UList<point>& points,
const LongList<edge>& edges,
const unallocLabelList& addr
)
{
// Remove unused points and create subaddressed edges
DynamicList<point> newPoints;
labelList newPointAddr(points.size(), -1);
LongList<edge> newEdges(addr.size());
forAll(addr, addrI)
{
label edgeI = addr[addrI];
const edge& curEdge = edges[edgeI];
edge& newEdge = newEdges[addrI];
forAll(curEdge, i)
{
label pointId = curEdge[i];
if (newPointAddr[pointId] == -1)
{
newPoints.append(points[pointId]);
newPointAddr[pointId] = newPoints.size()-1;
}
newEdge[i] = newPointAddr[pointId];
}
}
writeEdgesToVTK
(
fn,
title,
newPoints,
newEdges
);
}
//- Write the supplied facet list in serial vtkPolyData format
void writeFacetsToVTK
(
const fileName& fn,
const string& title,
const UList<point>& points,
const LongList<labelledTri>& facets
)
{
labelList connectivity(facets.size());
forAll(facets, faceI)
{
connectivity[faceI] = 3*(faceI+1);
}
labelList regionData(facets.size());
forAll(facets, faceI)
{
regionData[faceI] = facets[faceI].region();
}
xmlTag xmlRoot("VTKFile");
xmlRoot.addAttribute("type", "PolyData");
xmlTag& xmlPolyData = xmlRoot.addChild("PolyData");
xmlTag& xmlPiece = xmlPolyData.addChild("Piece");
xmlPiece.addAttribute("NumberOfPoints", points.size());
xmlPiece.addAttribute("NumberOfPolys", facets.size());
xmlTag& xmlPoints = xmlPiece.addChild("Points");
xmlTag& xmlPointData = xmlPoints.addChild("DataArray");
xmlPointData.addAttribute("type", "Float32");
xmlPointData.addAttribute("NumberOfComponents", 3);
xmlPointData.addAttribute("format", "ascii");
xmlPointData << points;
xmlTag& xmlPolys = xmlPiece.addChild("Polys");
xmlTag& xmlPolyDataArray = xmlPolys.addChild("DataArray");
xmlPolyDataArray.addAttribute("type", "Int32");
xmlPolyDataArray.addAttribute("Name", "connectivity");
xmlPolyDataArray.addAttribute("format", "ascii");
xmlPolyDataArray << facets;
xmlTag& xmlConnectData = xmlPolys.addChild("DataArray");
xmlConnectData.addAttribute("type", "Int32");
xmlConnectData.addAttribute("Name", "offsets");
xmlConnectData.addAttribute("format", "ascii");
xmlConnectData << connectivity;
xmlTag& xmlCellData = xmlPiece.addChild("CellData");
xmlTag& xmlCellDataArray = xmlCellData.addChild("DataArray");
xmlCellDataArray.addAttribute("type", "Int32");
xmlCellDataArray.addAttribute("Name", "region");
xmlCellDataArray.addAttribute("format", "ascii");
xmlCellDataArray << regionData;
OFstream os(fn);
os << xmlRoot << endl;
Info << "Created " << fn << endl;
}
//- Write an addressed subset of the supplied facet list
//- in serial vtkPolyData format
void writeFacetsToVTK
(
const fileName& fn,
const string& title,
const pointField& points,
const LongList<labelledTri>& facets,
const unallocLabelList& addr
)
{
// Remove unused points and create subaddressed facets
DynamicList<point> newPoints;
labelList newPointAddr(points.size(), -1);
LongList<labelledTri> newFacets(addr.size());
forAll(addr, addrI)
{
label faceI = addr[addrI];
const labelledTri& facet = facets[faceI];
const FixedList<label, 3>& pointIds = facet;
FixedList<label, 3> newPointIds;
forAll(pointIds, i)
{
label pointId = pointIds[i];
if (newPointAddr[pointId] == -1)
{
newPoints.append(points[pointId]);
newPointAddr[pointId] = newPoints.size()-1;
}
newPointIds[i] = newPointAddr[pointId];
}
newFacets[addrI] = labelledTri
(
newPointIds[0],
newPointIds[1],
newPointIds[2],
facet.region()
);
}
writeFacetsToVTK
(
fn,
title,
newPoints,
newFacets
);
}
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.clear();
argList::validArgs.append("input surface file");
argList::validArgs.append("output prefix");
argList args(argc, argv);
// Process commandline arguments
fileName inFileName(args.args()[1]);
fileName outPrefix(args.args()[2]);
// Read original surface
triSurf origSurf(inFileName);
const pointField& points = origSurf.points();
const LongList<labelledTri>& facets = origSurf.facets();
const LongList<edge>& edges = origSurf.featureEdges();
const geometricSurfacePatchList& patches = origSurf.patches();
label index = 0;
// Create file structure for multiblock dataset
mkDir(outPrefix);
mkDir(outPrefix + "/patches");
mkDir(outPrefix + "/pointSubsets");
mkDir(outPrefix + "/edgeSubsets");
mkDir(outPrefix + "/faceSubsets");
// Create VTK multiblock dataset file
xmlTag xmlRoot("VTKFile");
xmlRoot.addAttribute("type", "vtkMultiBlockDataSet");
xmlRoot.addAttribute("version", "1.0");
xmlRoot.addAttribute("byte_order", "LittleEndian");
xmlTag& xmlDataSet = xmlRoot.addChild("vtkMultiBlockDataSet");
// Write faces and feature edges
{
fileName fn = outPrefix / "facets.vtp";
writeFacetsToVTK
(
outPrefix / "facets.vtp",
outPrefix,
points,
facets
);
xmlTag& tag = xmlDataSet.addChild("DataSet");
tag.addAttribute("index", Foam::name(index++));
tag.addAttribute("name", "facets");
tag.addAttribute("file", fn);
}
{
fileName fn = outPrefix / "featureEdges.vtp";
writeEdgesToVTK
(
outPrefix / "featureEdges.vtp",
"featureEdges",
points,
edges
);
xmlTag& tag = xmlDataSet.addChild("DataSet");
tag.addAttribute("index", Foam::name(index++));
tag.addAttribute("name", "featureEdges");
tag.addAttribute("file", fn);
}
// Write patches
// Create patch addressing
List<DynamicList<label> > patchAddr(patches.size());
forAll(facets, faceI)
{
patchAddr[facets[faceI].region()].append(faceI);
}
{
xmlTag& xmlBlock = xmlDataSet.addChild("Block");
xmlBlock.addAttribute("index", Foam::name(index++));
xmlBlock.addAttribute("name", "patches");
forAll(patches, patchI)
{
word patchName = patches[patchI].name();
fileName fn = outPrefix / "patches" / patchName + ".vtp";
writeFacetsToVTK
(
fn,
patchName,
points,
facets,
patchAddr[patchI]
);
xmlTag& tag = xmlBlock.addChild("DataSet");
tag.addAttribute("index", Foam::name(patchI));
tag.addAttribute("name", patchName);
tag.addAttribute("file", fn);
}
}
// Write point subsets
{
xmlTag& xmlBlock = xmlDataSet.addChild("Block");
xmlBlock.addAttribute("index", Foam::name(index++));
xmlBlock.addAttribute("name", "pointSubsets");
DynList<label> subsetIndices;
labelList subsetAddr;
origSurf.pointSubsetIndices(subsetIndices);
forAll(subsetIndices, id)
{
word subsetName = origSurf.pointSubsetName(id);
origSurf.pointsInSubset(id, subsetAddr);
fileName fn = outPrefix / "pointSubsets" / subsetName + ".vtp";
writePointsToVTK
(
fn,
subsetName,
points,
subsetAddr
);
xmlTag& tag = xmlBlock.addChild("DataSet");
tag.addAttribute("index", Foam::name(id));
tag.addAttribute("name", subsetName);
tag.addAttribute("file", fn);
}
}
// Write edge subsets
{
xmlTag& xmlBlock = xmlDataSet.addChild("Block");
xmlBlock.addAttribute("index", Foam::name(index++));
xmlBlock.addAttribute("name", "edgeSubsets");
DynList<label> subsetIndices;
labelList subsetAddr;
origSurf.edgeSubsetIndices(subsetIndices);
forAll(subsetIndices, id)
{
word subsetName = origSurf.edgeSubsetName(id);
origSurf.edgesInSubset(id, subsetAddr);
fileName fn = outPrefix / "edgeSubsets" / subsetName + ".vtp";
writeEdgesToVTK
(
fn,
subsetName,
points,
edges,
subsetAddr
);
xmlTag& tag = xmlBlock.addChild("DataSet");
tag.addAttribute("index", Foam::name(id));
tag.addAttribute("name", subsetName);
tag.addAttribute("file", fn);
}
}
// Write facet subsets
{
xmlTag& xmlBlock = xmlDataSet.addChild("Block");
xmlBlock.addAttribute("index", Foam::name(index++));
xmlBlock.addAttribute("name", "faceSubsets");
DynList<label> subsetIndices;
labelList subsetAddr;
origSurf.facetSubsetIndices(subsetIndices);
forAll(subsetIndices, id)
{
word subsetName = origSurf.facetSubsetName(id);
origSurf.facetsInSubset(id, subsetAddr);
fileName fn = outPrefix / "faceSubsets" / subsetName + ".vtp";
writeFacetsToVTK
(
fn,
subsetName,
points,
facets,
subsetAddr
);
xmlTag& tag = xmlBlock.addChild("DataSet");
tag.addAttribute("index", Foam::name(id));
tag.addAttribute("name", subsetName);
tag.addAttribute("file", fn);
}
}
OFstream os(outPrefix + ".vtm");
os << xmlRoot << endl;
Info << "Created " << outPrefix + ".vtm" << endl;
Info << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -0,0 +1,3 @@
FMSToVTK.C
EXE = $(FOAM_APPBIN)/FMSToVTK

View file

@ -0,0 +1,9 @@
EXE_INC = \
-I$(FOAM_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
-I$(FOAM_SRC)/meshTools/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude
EXE_LIBS = \
-ltriSurface \
-lmeshLibrary \
-lmeshTools

View file

@ -0,0 +1,297 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::xmlTag
Description
Simple XML tag class allowing child tags and attributes. Specialized
output stream operators are provided to display or write the XML
structure.
Author
Ivor Clifford <ivor.clifford@psi.ch>
\*---------------------------------------------------------------------------*/
#ifndef XMLtag_H
#define XMLtag_H
#include "OStringStream.H"
#include "HashTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class xmlTag Declaration
\*---------------------------------------------------------------------------*/
class xmlTag
:
public OStringStream
{
// Private data
//- Tag name
word name_;
//- Attributes
HashTable<string> attributes_;
//- Child tags
DynamicList<xmlTag> children_;
public:
// Constructors
//- Null constructor
xmlTag()
:
OStringStream(),
name_("unknown"),
attributes_(),
children_()
{}
//- Construct given tag name
xmlTag(const word& name)
:
OStringStream(),
name_(name),
attributes_(),
children_()
{}
//- Construct as copy
xmlTag(const xmlTag& tag)
:
OStringStream(tag),
name_(tag.name_),
attributes_(tag.attributes_),
children_(tag.children_)
{}
//- Destructor
~xmlTag()
{}
// Member Functions
//- Add an attribute
template<class T>
void addAttribute(const keyType& key, const T& value)
{
OStringStream os;
os << value;
attributes_.insert(key, os.str());
};
//- Add a fileName attribute
void addAttribute(const keyType& key, const fileName& value)
{
attributes_.insert(key, value);
};
//- Add a string attribute
void addAttribute(const keyType& key, const string& value)
{
attributes_.insert(key, value);
};
//- Add a word attribute
void addAttribute(const keyType& key, const word& value)
{
attributes_.insert(key, value);
};
//- Add a child
xmlTag& addChild(const xmlTag& tag)
{
children_.append(tag);
return children_[children_.size()-1];
};
//- Create and add a new child
xmlTag& addChild(const word& name)
{
return addChild(xmlTag(name));
}
// Member Operators
void operator=(const xmlTag& tag)
{
name_ = tag.name_;
attributes_ = tag.attributes_;
children_ = tag.children_;
OStringStream::rewind();
Foam::operator<<(*this, tag.str().c_str());
};
// Friend IOstream Operators
friend Ostream& operator<<(Ostream&, const xmlTag&);
template<class Form, class Cmpt, int nCmpt>
friend xmlTag& operator<<(xmlTag&, const VectorSpace<Form, Cmpt, nCmpt>&);
friend xmlTag& operator<<(xmlTag&, const labelledTri&);
template<class T, unsigned Size>
friend xmlTag& operator<<(xmlTag&, const FixedList<T, Size>&);
template<class T>
friend xmlTag& operator<<(xmlTag&, const LongList<T>&);
template<class T>
friend xmlTag& operator<<(xmlTag&, const UList<T>&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Write the tag in XML format to the supplied output stream
Ostream& operator<<(Ostream& os, const xmlTag& tag)
{
// Tag name
os << indent << '<' << tag.name_;
// Attributes and text
for
(
HashTable<string>::const_iterator iter = tag.attributes_.cbegin();
iter != tag.attributes_.cend();
++iter
)
{
os << token::SPACE << iter.key() << '=' << iter();
}
if (tag.str().size() || tag.children_.size())
{
os << '>' << nl;
// Children
os.incrIndent();
forAll(tag.children_, i)
{
os << tag.children_[i];
}
os.decrIndent();
// Tag text
os << tag.str().c_str();
// Close tag
os << indent << "</" << tag.name_ << '>' << endl;
}
else
{
// Empty element tag
os << "/>" << endl;
}
return os;
}
//- Append the supplied data to the tag text
template<class T>
xmlTag& operator<<(xmlTag& tag, const UList<T>& data)
{
forAll(data, i)
{
tag << data[i] << token::SPACE;
}
tag << nl;
return tag;
}
//- Append the supplied data to the tag text
template<class T>
xmlTag& operator<<(xmlTag& tag, const LongList<T>& data)
{
forAll(data, i)
{
tag << data[i] << token::SPACE;
}
tag << nl;
return tag;
}
//- Append the supplied data to the tag text
template<class Form, class Cmpt, int nCmpt>
xmlTag& operator<<(xmlTag& tag, const VectorSpace<Form, Cmpt, nCmpt>& data)
{
forAll(data, i)
{
tag << data[i] << token::SPACE;
}
tag << nl;
return tag;
}
//- Append the supplied data to the tag text
template<class T, unsigned Size>
xmlTag& operator<<(xmlTag& tag, const FixedList<T, Size>& data)
{
forAll(data, i)
{
tag << data[i] << token::SPACE;
}
tag << nl;
return tag;
}
//- Append the supplied data to the tag text
xmlTag& operator<<(xmlTag& tag, const labelledTri& data)
{
const triFace& tFace = data;
return tag << tFace;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,3 @@
importSurfaceAsSubset.C
EXE = $(FOAM_APPBIN)/importSurfaceAsSubset

View file

@ -0,0 +1,9 @@
EXE_INC = \
-I$(FOAM_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-ltriSurface \
-lmeshLibrary \
-lmeshTools

View file

@ -0,0 +1,84 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of cfMesh.
cfMesh 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.
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Finds feature edges and corners of a triangulated surface
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "IFstream.H"
#include "fileName.H"
#include "triSurf.H"
#include "OFstream.H"
#include "OSspecific.H"
#include "demandDrivenData.H"
#include "triSurfaceImportSurfaceAsSubset.H"
#include <cstdlib>
#include <sstream>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
using namespace Foam;
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.clear();
argList::validArgs.append("master surface file");
argList::validArgs.append("import surface file");
argList args(argc, argv);
fileName inFileName(args.args()[1]);
fileName importFileName(args.args()[2]);
triSurf originalSurface(inFileName);
triSurf importedSurface(importFileName);
triSurfaceImportSurfaceAsSubset importSurf(originalSurface);
importSurf.addSurfaceAsSubset(importedSurface, importFileName.lessExt());
if( inFileName.ext() == "fms" )
{
originalSurface.writeSurface(inFileName);
}
else
{
fileName newName = inFileName.lessExt();
newName.append(".fms");
Warning << "Writting surface as " << newName
<< " to preserve the subset!!" << endl;
originalSurface.writeSurface(newName);
}
Info << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -0,0 +1,3 @@
improveSymmetryPlanes.C
EXE = $(FOAM_APPBIN)/improveSymmetryPlanes

View file

@ -0,0 +1,7 @@
EXE_INC = \
-I$(FOAM_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lmeshTools \
-lmeshLibrary

View file

@ -0,0 +1,57 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of cfMesh.
cfMesh 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.
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Ensures that all mesh points belonging to a symmetryPlane are
in a plane.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "polyMeshGenModifier.H"
#include "symmetryPlaneOptimisation.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
polyMeshGen pmg(runTime);
pmg.read();
Info << "Starting optimisation of symmetry planes" << endl;
symmetryPlaneOptimisation(pmg).optimizeSymmetryPlanes();
Info << "Writing mesh" << endl;
pmg.write();
Info << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -0,0 +1,3 @@
mergeSurfacePatches.C
EXE = $(FOAM_APPBIN)/mergeSurfacePatches

View file

@ -0,0 +1,9 @@
EXE_INC = \
-I$(FOAM_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
-I$(FOAM_SRC)/meshTools/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude
EXE_LIBS = \
-ltriSurface \
-lmeshLibrary \
-lmeshTools

View file

@ -0,0 +1,403 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of cfMesh.
cfMesh 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.
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
cfMesh utility to merge the supplied list of patches onto a single
patch.
Author
Ivor Clifford <ivor.clifford@psi.ch>
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "autoPtr.H"
#include "Time.H"
#include "triSurf.H"
#include "triSurfModifier.H"
#include "demandDrivenData.H"
#include "Pair.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Find the supplied list of patch names and return a list of patch Ids
void getPatchIds
(
const triSurf& origSurf,
const wordList& patchNames,
DynamicList<label>& patchIds
)
{
const geometricSurfacePatchList& origPatches = origSurf.patches();
// Create patch name map
HashSet<word> patchNameHash(patchNames);
// Find selected patches
label nFound = 0;
forAll(origPatches, patchI)
{
if (patchNameHash.found(origPatches[patchI].name()))
{
patchIds.append(patchI);
nFound++;
}
}
if (nFound != patchNames.size())
{
WarningIn("getPatchIds")
<< "Not all supplied patch names were found on the surface mesh" << endl;
}
}
// Copy all face subsets from one triSurf to another
void copyFaceSubsets
(
const triSurf& origSurf,
triSurf& newSurf
)
{
DynList<label> subsetIds;
origSurf.facetSubsetIndices(subsetIds);
forAll(subsetIds, subsetI)
{
label newSubsetId = newSurf.addFacetSubset
(
origSurf.facetSubsetName(subsetI)
);
labelList origFaces;
origSurf.facetsInSubset(subsetI, origFaces);
forAll(origFaces, faceI)
{
newSurf.addFacetToSubset
(
newSubsetId,
origFaces[faceI]
);
}
}
}
// Copy all edge subsets from one triSurf to another
void copyEdgeSubsets
(
const triSurf& origSurf,
triSurf& newSurf
)
{
DynList<label> subsetIds;
origSurf.edgeSubsetIndices(subsetIds);
forAll(subsetIds, subsetI)
{
label newSubsetId = newSurf.addEdgeSubset
(
origSurf.edgeSubsetName(subsetI)
);
labelList origEdges;
origSurf.edgesInSubset(subsetI, origEdges);
forAll(origEdges, faceI)
{
newSurf.addEdgeToSubset
(
newSubsetId,
origEdges[faceI]
);
}
}
}
// Copy all point subsets from one triSurf to another
void copyPointSubsets
(
const triSurf& origSurf,
triSurf& newSurf
)
{
DynList<label> subsetIds;
origSurf.pointSubsetIndices(subsetIds);
forAll(subsetIds, subsetI)
{
label newSubsetId = newSurf.addPointSubset
(
origSurf.pointSubsetName(subsetI)
);
labelList origPoints;
origSurf.pointsInSubset(subsetI, origPoints);
forAll(origPoints, faceI)
{
newSurf.addPointToSubset
(
newSubsetId,
origPoints[faceI]
);
}
}
}
// Merge the supplied list of patchIds onto a new patch
autoPtr<triSurf> mergeSurfacePatches
(
const triSurf& origSurf, // Surface
const UList<label>& patchIds, // Ids of patches to merge
const word& newPatchName, // Name of new (merged) patch
bool keepPatches // Keep the original patches - they will be emptied
)
{
const geometricSurfacePatchList& origPatches = origSurf.patches();
const LongList<labelledTri>& origFacets = origSurf.facets();
label newPatchId = origPatches.size();
// Determine new patch type
word newPatchType = origPatches[patchIds[0]].geometricType();
// Create patch addressing
List<DynamicList<label> > patchAddr(origPatches.size()+1);
forAll(origFacets, faceI)
{
patchAddr[origFacets[faceI].region()].append(faceI);
}
// Move selected patches to new patch
forAll(patchIds, patchI)
{
patchAddr[newPatchId].append(patchAddr[patchIds[patchI]]);
patchAddr[patchIds[patchI]].clear();
}
// Create new facets list
LongList<labelledTri> newFacets(origFacets.size());
labelList newFaceAddr(origFacets.size(), -1);
label patchCount = 0;
label faceI = 0;
forAll(patchAddr, patchI)
{
const unallocLabelList& addr = patchAddr[patchI];
if(addr.size())
{
forAll(addr, i)
{
newFacets[faceI] = origFacets[addr[i]];
newFacets[faceI].region() = patchCount;
newFaceAddr[addr[i]] = faceI;
faceI++;
}
}
if(addr.size() || keepPatches)
{
patchCount++;
}
}
// Create new patch list
geometricSurfacePatchList newPatches(patchCount);
patchCount = 0;
forAll(origPatches, patchI)
{
// Only add patches if they contain faces
if(patchAddr[patchI].size())
{
newPatches[patchCount] = origPatches[patchI];
newPatches[patchCount].index() = patchCount;
}
if(patchAddr[patchI].size() || keepPatches)
{
patchCount++;
}
}
// Add new patch if it contains faces
if(patchAddr[patchAddr.size()-1].size())
{
newPatches[patchCount] = geometricSurfacePatch
(
newPatchType,
newPatchName,
patchCount
);
}
if(patchAddr[patchAddr.size()-1].size() || keepPatches)
{
patchCount++;
}
// Create new surface
autoPtr<triSurf> newSurf
(
new triSurf
(
newFacets,
newPatches,
origSurf.featureEdges(),
origSurf.points()
)
);
// Transfer face subsets
copyFaceSubsets(origSurf, newSurf());
newSurf->updateFacetsSubsets(newFaceAddr);
// Transfer feature edge subsets
copyEdgeSubsets(origSurf, newSurf());
// Transfer point subsets
copyPointSubsets(origSurf, newSurf());
// Done
return newSurf;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.clear();
argList::validArgs.append("input surface file");
argList::validArgs.append("new patch");
argList::validOptions.insert("patchNames", "list of names");
argList::validOptions.insert("patchIds", "list of patchIds");
argList::validOptions.insert("patchIdRange", "( start end )");
argList::validOptions.insert("output", "file name (default overwrite)");
argList::validOptions.insert("keep", "");
argList args(argc, argv);
// Process commandline arguments
fileName inFileName(args.args()[1]);
word newPatchName(args.args()[2]);
fileName outFileName(inFileName);
if( args.options().found("output") )
{
outFileName = args.options()["output"];
}
bool keepPatches = false;
if( args.options().found("keep") )
{
keepPatches = true;
}
// Read original surface
triSurf origSurf(inFileName);
// Get patch ids
DynamicList<label> patchIds;
if (args.options().found("patchNames"))
{
if (args.options().found("patchIds"))
{
FatalError() << "Cannot specify both patch names and ids"
<< Foam::abort(FatalError);
}
IStringStream is(args.options()["patchNames"]);
wordList patchNames(is);
getPatchIds
(
origSurf,
patchNames,
patchIds
);
}
if (args.options().found("patchIds"))
{
IStringStream is(args.options()["patchIds"]);
patchIds = labelList(is);
}
if (args.options().found("patchIds"))
{
IStringStream is(args.options()["patchIds"]);
patchIds.append(labelList(is));
}
if (args.options().found("patchIdRange"))
{
IStringStream is(args.options()["patchIdRange"]);
Pair<label> idRange(is);
for(label id = idRange.first(); id <= idRange.second(); id++)
{
patchIds.append(id);
}
}
if (!patchIds.size())
{
FatalError() << "No patches specified"
<< Foam::abort(FatalError);
}
// Merge patches
autoPtr<triSurf> newSurf = mergeSurfacePatches
(
origSurf,
patchIds,
newPatchName,
keepPatches
);
// Write new surface mesh
newSurf->writeSurface(outFileName);
Info << "Original surface patches: " << origSurf.patches().size() << endl;
Info << "Final surface patches: " << newSurf->patches().size() << endl;
Info << "Surface written to " << outFileName << endl;
Info << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -0,0 +1,131 @@
#!python
# =============================================================================
# Salome GEOM script to extract the feature edges from a body and add them
# to the group named 'featureEdges'.
# Tested on Salome 7.4.0 and python 2.7 on 64-bit Windows
#
# Author: Ivor Clifford <ivor.clifford@psi.ch>
#
# =============================================================================
def extractFeatureEdges(body, minFeatureAngle = 5):
'''
Find all feature edges on the supplied body and return them as a list
of edge ids.
body - A Salome solid, compound, shell or face object to find all
feature edges on.
minFeatureAngle - the angle (in degrees) between adjacent surfaces
above which the edge will be considered a feature angle.
'''
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
# Check the body type
if not (body.GetShapeType() in [GEOM.SHELL, GEOM.SOLID, GEOM.FACE, GEOM.COMPOUND]):
raise RuntimeError('Supplied object is not a solid, shell or face.')
print 'Extracting edges of %s with feature angle > %g.' % (body.GetName(), minFeatureAngle)
# Extract basic info
faces = geompy.SubShapeAll(body, geompy.ShapeType["FACE"])
curves = geompy.SubShapeAll(body, geompy.ShapeType["EDGE"])
points = geompy.SubShapeAll(body, geompy.ShapeType["VERTEX"])
faceIds = geompy.GetSubShapesIDs(body, faces)
curveIds = geompy.GetSubShapesIDs(body, curves)
nodeIds = geompy.GetSubShapesIDs(body, points)
maxFaceId = max(faceIds)
maxCurveId = max(curveIds)
maxNodeId = max(nodeIds)
# Reverse mapping from curve id to local curve arrays
faceMap = [-1 for i in xrange(maxFaceId+1)]
for localId, id in enumerate(faceIds):
faceMap[id] = localId
curveMap = [-1 for i in xrange(maxCurveId+1)]
for localId, id in enumerate(curveIds):
curveMap[id] = localId
nodeMap = [-1 for i in xrange(maxNodeId+1)]
for localId, id in enumerate(nodeIds):
nodeMap[id] = localId
# Get curves on each face
faceCurveIds = [[curveMap[id] for id in geompy.GetSubShapesIDs(
body,
geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
)] for face in faces]
# Get faces attached to each curve
curveFaceIds = [[] for id in curveIds]
for faceI, ids in enumerate(faceCurveIds):
for id in ids:
curveFaceIds[id].append(faceI)
# Now that we have the connectivity for curves and faces find the
# feature edges
featureEdgeIds = []
for curveId, curve, adjFaceIds in zip(curveIds, curves, curveFaceIds):
if len(adjFaceIds) == 2:
# Curve with 2 adjacent faces - Test feature angle
# Determine break angle at each curve
# If greater than the feature edge angle, add the curve to group featureEdges
face1 = faces[adjFaceIds[0]]
face2 = faces[adjFaceIds[1]]
point = geompy.GetFirstVertex(curve) # Test at the first vertex
n1 = geompy.GetNormal(face1, point)
n2 = geompy.GetNormal(face2, point)
angle = geompy.GetAngle(n1, n2)
if angle > minFeatureAngle:
featureEdgeIds.append(curveId)
elif len(adjFaceIds) == 1:
# Curve on standalone face - Add by default
featureEdgeIds.append(curveId)
elif len(adjFaceIds) == 0:
# Standalone curve - Ignore
None
else:
raise RuntimeError('Curve found sharing %d faces. This is unexpected for fully enclosed bodies.' % len(adjFaceIds))
# Done
print "%d feature edges found" % len(featureEdgeIds)
return featureEdgeIds
# If run as a standalone script, use the current Salome GUI selection
# and add the feature edges to group named 'featureEdges'
if __name__ == '__main__':
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
# Get current GUI selection
selected = salome.sg.getAllSelected()
if len(selected) != 1:
raise RuntimeError('A single solid, shell or face object must be selected.')
body = salome.myStudy.FindObjectID(selected[0]).GetObject()
# Get feature edges and add to the group 'featureEdges'
featureEdges = geompy.CreateGroup(body, geompy.ShapeType["EDGE"])
geompy.UnionIDs(featureEdges, extractFeatureEdges(body))
geompy.addToStudyInFather(body, featureEdges, 'featureEdges')
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)

View file

@ -0,0 +1,363 @@
#!python
# =============================================================================
# Python module for writing OpenFOAM feature edge and triSurface files from
# within Salome platform.
# Tested on Salome 7.4.0 and python 2.7 on 64-bit Windows
#
# Author: Ivor Clifford <ivor.clifford@psi.ch>
#
# =============================================================================
def foamHeader(className, objectName):
'''
Return the OpenFOAM file header block as a string.
'''
return '''/*--------------------------------*- C++ -*----------------------------------*\\
| ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\\\ / O peration | Version: 2.2.1 |
| \\\\ / A nd | Web: www.OpenFOAM.org |
| \\\\/ M anipulation | |
\\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class %s;
object %s;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
''' % (className, objectName)
class triSurf:
def __init__(self, object = None, allEdges = False):
'''
Construct from the supplied Salome mesh.
object - the mesh object (must be a triangular surface mesh). If no
object is supplied, the current Salome selection is used.
allEdges - If true, all edges on the mesh are included as feature
edges, otherwise only edges contained in groups are included
NOTE: All face groups are assumed to represent patches. No face subsets
are written. All edge groups are added as feature edge subsets. All point
groups are added as point subsets.
'''
# =============================================================================
# Initialize salome
import salome
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
from operator import itemgetter
from collections import OrderedDict
import SMESH, SALOMEDS
# =============================================================================
# Get the Salome mesh object
if object is None:
selected = salome.sg.getAllSelected()
if len(selected) != 1:
raise RuntimeError('A single Salome mesh object must be selected.')
object = salome.myStudy.FindObjectID(selected[0]).GetObject()
try:
object.GetMesh()
except:
raise RuntimeError('Supplied object is not a Salome SMESH mesh.')
smesh = smeshBuilder.New(salome.myStudy)
mesh = smesh.Mesh(object)
print "Converting SMESH Mesh '%s'" % mesh.GetName()
# =============================================================================
# Get basic mesh info
nNodes = mesh.NbNodes()
nFaces = mesh.NbFaces()
nTris = mesh.NbTriangles()
nEdges = mesh.NbEdges()
nodeIds = mesh.GetNodesId()
faceIds = mesh.GetElementsByType(SMESH.FACE)
edgeIds = mesh.GetElementsByType(SMESH.EDGE)
# Check that mesh is strictly triangular
if nFaces != nTris:
raise RuntimeError('Mesh is not strictly triangular')
# Get patch and subset names & ids
# All SMESH.FACE groups are assumed to be patches
# All SMESH.EDGE groups are assumed to be feature subsets
# All SMESH.NODE groups are assumed to be point subsets
patches = OrderedDict()
pointSubsets = OrderedDict()
featureEdgeSubsets = OrderedDict()
for group in mesh.GetGroups():
if group.GetType() == SMESH.FACE:
patches[group.GetName()] = group.GetIDs()
elif group.GetType() == SMESH.EDGE:
featureEdgeSubsets[group.GetName()] = group.GetIDs()
elif group.GetType() == SMESH.NODE:
pointSubsets[group.GetName()] = group.GetIDs()
# =============================================================================
# Process faces and patches
# Get patchId for each face
lastPatchId = len(patches)
patchIds = [lastPatchId] * max(faceIds)
patchId = 0
for name, ids in patches.iteritems():
for faceId in ids:
if patchIds[faceId-1] == lastPatchId:
patchIds[faceId-1] = patchId
else:
print "Face %d is assigned to both groups %s and %s" % (faceId, name, patches.keys()[patchIds[faceId-1]])
raise RuntimeError('Groups of faces are not unique, i.e. they overlap.')
patchId += 1
# Compact and reorder patchIds to match faceIds
patchIds = [patchIds[faceId-1] for faceId in faceIds]
# Reorder faces by increasing group id
faceAndpatchIds = sorted(zip(faceIds, patchIds), key=itemgetter(1))
faceIds, patchIds = zip(*faceAndpatchIds)
# Add unused faces to the default patch
defaultFaces = [faceId for faceId, patchId in faceAndpatchIds if patchId == lastPatchId]
if len(defaultFaces) > 0:
patches['defaultFaces'] = defaultFaces
defaultFaces = None
# =============================================================================
# Process feature edges
if not allEdges:
edgeIds = []
for name, ids in featureEdgeSubsets.iteritems():
edgeIds += ids
edgeIds = list(set(edgeIds))
nEdges = len(edgeIds)
# Reverse mapping of edge ids since they aren't necessarily numbered 1..nEdges
if len(edgeIds):
edgeMap = [-1] * max(edgeIds)
else:
edgeMap = []
i=0
for edgeId in edgeIds:
edgeMap[edgeId-1] = i
i += 1
# =============================================================================
# Process nodes
# Reverse mapping of node ids since nodes aren't necessarily numbered 1..nNodes
nodeMap = [-1] * max(nodeIds)
i=0
for nodeId in nodeIds:
nodeMap[nodeId-1] = i
i += 1
# =============================================================================
self._mesh = mesh
self._nodeIds = nodeIds
self._edgeIds = edgeIds
self._faceIds = faceIds
self._nodeMap = nodeMap
self._edgeMap = edgeMap
self._faceMap = []
self._patches = patches
self._pointSubsets = pointSubsets
self._featureEdgeSubsets = featureEdgeSubsets
self._faceSubsets = {}
print 'Done'
def nNodes(self):
'''
Return the number of nodes
'''
return len(self._nodeIds)
def nEdges(self):
'''
Return the number of edges
'''
return len(self._edgeIds)
def nFacets(self):
'''
Return the number of triangular facets
'''
return len(self._faceIds)
def nPatches(self):
'''
Return the number of patches
'''
return len(self._patches)
def _writePatchDefs(self, f, typeName = 'wall'):
'''
Write the patch definitions to file as an OpenFOAM geometricSurfacePatchList.
NOTE: All patches are assumed to be walls.
'''
patches = self._patches
f.write('%d\n(\n' % len(patches))
for name in patches.iterkeys():
f.write('%s\t%s\n' % (name, typeName))
f.write(')\n')
def _writeNodes(self, f):
'''
Write the nodes to file as an OpenFOAM pointField.
'''
mesh = self._mesh
nodeIds = self._nodeIds
f.write('%d\n(\n' % len(nodeIds))
for x, y, z in [mesh.GetNodeXYZ(nodeId) for nodeId in nodeIds]:
f.write( '( %g %g %g )\n' % (x, y, z))
f.write(')\n')
def _writeFeatureEdges(self, f):
'''
Write the feature edges to file as an OpenFOAM edgeList.
'''
mesh = self._mesh
nodeMap = self._nodeMap
edgeIds = self._edgeIds
f.write('%d\n(\n' % len(edgeIds))
for edgeId in edgeIds:
nodes = mesh.GetElemNodes(edgeId)
f.write( '(' + ' '.join([str(nodeMap[nodeId-1]) for nodeId in nodes]) + ')\n')
f.write(')\n')
def _writeFacets(self, f):
'''
Write the facets to file as an OpenFOAM List of labelledTri.
'''
from itertools import chain
mesh = self._mesh
nodeMap = self._nodeMap
patches = self._patches
f.write('%d\n(\n' % sum([len(patch) for patch in patches.itervalues()]))
patchId = 0
for patchId, (patchName, faceIds) in enumerate(patches.iteritems()):
for faceId in faceIds:
nodes = mesh.GetElemNodes(faceId)
f.write( '((' + ' '.join([str(nodeMap[nodeId-1]) for nodeId in nodes]) + ') %d)\n' % patchId)
f.write(')\n')
def _writeSubsets(self, f, subsets, map, typeId):
'''
General function to write a subset to file as an OpenFOAM Map<meshSubset>.
'''
f.write('%d\n(\n' % len(subsets))
for name, ids in subsets.iteritems():
f.write('%s %s %d ( %s )\n' % (name, typeId, len(ids), ' '.join([str(map[id-1]) for id in ids])))
f.write(')\n')
def _writePointSubsets(self, f):
'''
Write the point subsets to file as and OpenFOAM Map<meshSubset>.
'''
self._writeSubsets(f, self._pointSubsets, self._nodeMap, '2')
def _writeFaceSubsets(self, f):
'''
Write the face subsets to file as and OpenFOAM Map<meshSubset>.
'''
self._writeSubsets(f, self._faceSubsets, self._faceMap, '4')
def _writeFeatureEdgeSubsets(self, f):
'''
Write the feature edge subsets to file as and OpenFOAM Map<meshSubset>.
'''
self._writeSubsets(f, self._featureEdgeSubsets, self._edgeMap, '8')
def writeEdgeMesh(self, fileName):
'''
Write to file as an OpenFOAM edgeMesh
fileName - The file name to write
'''
# Create file
f = open(fileName, 'wb') # NOTE: file opened as binary to ensure unix-style line breaks
# Write header
f.write(foamHeader('edgeMesh', self._mesh.GetName()))
self._writeNodes(f)
self._writeFeatureEdges(f)
f.close()
print 'edgeMesh written to %s' % fileName
def writeFtr(self, fileName):
'''
Write to file as an OpenFOAM cfMesh FTR file
fileName - the file name to write
'''
# Create file
f = open(fileName, 'wb') # NOTE: file opened as binary to ensure unix-style line breaks
self._writePatchDefs(f)
self._writeNodes(f)
self._writeFacets(f)
f.close()
print 'triSurf written to %s' % fileName
def writeFms(self, fileName):
'''
Write to file as an OpenFOAM cfMesh FMS file
fileName - the file name to write
'''
# Create file
f = open(fileName, 'wb') # NOTE: file opened as binary to ensure unix-style line breaks
self._writePatchDefs(f)
self._writeNodes(f)
self._writeFacets(f)
self._writeFeatureEdges(f)
self._writePointSubsets(f)
self._writeFaceSubsets(f)
self._writeFeatureEdgeSubsets(f)
f.close()
print 'triSurf written to %s' % fileName
if __name__ == '__main__':
import salome
salome.salome_init()
import SMESH, SALOMEDS

View file

@ -0,0 +1,3 @@
surfaceToFMS.C
EXE = $(FOAM_APPBIN)/surfaceToFMS

View file

@ -0,0 +1,9 @@
EXE_INC = \
-I$(FOAM_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-ltriSurface \
-lmeshLibrary \
-lmeshTools

View file

@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of cfMesh.
cfMesh 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.
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Reads the specified surface and writes it in the fms format.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "IFstream.H"
#include "fileName.H"
#include "triSurf.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
using namespace Foam;
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.clear();
argList::validArgs.append("input surface file");
argList args(argc, argv);
const fileName inFileName(args.args()[1]);
if( inFileName.ext() == "fms" )
FatalError << "trying to convert a fms file to itself"
<< exit(FatalError);
fileName outFileName(inFileName.lessExt()+".fms");
const triSurf surface(inFileName);
surface.writeSurface(outFileName);
Info << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -1,3 +0,0 @@
foamDebugSwitches.C
EXE = $(FOAM_APPBIN)/foamDebugSwitches

View file

@ -1,46 +0,0 @@
EXE_LIBS = \
-lbasicThermophysicalModels \
-lchemistryModel \
-lreactionThermophysicalModels \
-lcompressibleLESModels \
-ldecompositionMethods \
-ldieselSpray \
-ldynamicFvMesh \
-ldynamicMesh \
-ledgeMesh \
-lengine \
-lerrorEstimation \
-lfiniteVolume \
-lfiniteArea \
-lfoam \
-ltetFiniteElement \
-ltetMotionSolver \
-lforces \
-lfvMotionSolver \
-lincompressibleLESModels \
-lincompressibleTransportModels \
-lcompressibleRASModels \
-lincompressibleRASModels \
-linterfaceProperties \
-llagrangianIntermediate \
-llagrangian \
-llaminarFlameSpeedModels \
-lLESdeltas \
-lLESfilters \
-lliquidMixture \
-lliquids \
-lmeshTools \
-lODE \
-lpdf \
-lphaseModel \
-lradiation \
-lrandomProcesses \
-lsampling \
-lsolidMixture \
-lsolids \
-lspecie \
-lthermophysicalFunctions \
-ltopoChangerFvMesh \
-ltriSurface \
-lautoMesh \
-L$(MESQUITE_LIB_DIR) -lmesquite

View file

@ -1,152 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
Write out all library debug switches
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "dictionary.H"
#include "IFstream.H"
#include "IOobject.H"
#include "HashSet.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validOptions.insert("new", "");
argList::validOptions.insert("old", "");
Foam::argList args(argc, argv);
wordList currDebug(debug::debugSwitches().toc());
wordList currInfo(debug::infoSwitches().toc());
wordList currOpt(debug::optimisationSwitches().toc());
if (args.optionFound("old") || args.optionFound("new"))
{
dictionary controlDict(IFstream(findEtcFile("controlDict", true))());
wordHashSet oldDebug
(
controlDict.subDict("DebugSwitches").toc()
);
wordHashSet oldInfo
(
controlDict.subDict("InfoSwitches").toc()
);
wordHashSet oldOpt
(
controlDict.subDict("OptimisationSwitches").toc()
);
wordHashSet hashset;
wordList listing;
// list old switches - but this can't work since the (old) inserted
// switches are in both sets
// Workaround:
// 1. run without any options (get complete list)
// 2. comment out DebugSwitches, run again with -new to find new ones
// and do a diff
if (args.optionFound("old"))
{
IOobject::writeDivider(Info);
hashset = wordHashSet(oldDebug);
hashset -= wordHashSet(currDebug);
listing = hashset.toc();
sort(listing);
Info<< "old DebugSwitches: " << listing << endl;
hashset = wordHashSet(oldInfo);
hashset -= wordHashSet(currInfo);
listing = hashset.toc();
sort(listing);
Info<< "old InfoSwitches: " << listing << endl;
hashset = wordHashSet(oldOpt);
hashset -= wordHashSet(currOpt);
listing = hashset.toc();
sort(listing);
Info<< "old OptimisationSwitches: " << listing << endl;
}
// list new switches
if (args.optionFound("new"))
{
IOobject::writeDivider(Info);
hashset = wordHashSet(currDebug);
hashset -= wordHashSet(oldDebug);
listing = hashset.toc();
sort(listing);
Info<< "new DebugSwitches: " << listing << endl;
hashset = wordHashSet(currInfo);
hashset -= wordHashSet(oldInfo);
listing = hashset.toc();
sort(listing);
Info<< "new InfoSwitches: " << listing << endl;
hashset = wordHashSet(currOpt);
hashset -= wordHashSet(oldOpt);
listing = hashset.toc();
sort(listing);
Info<< "new OptimisationSwitches: " << listing << endl;
}
}
else
{
IOobject::writeDivider(Info);
sort(currDebug);
Info<< "DebugSwitches: " << currDebug << endl;
sort(currInfo);
Info<< "InfoSwitches: " << currInfo << endl;
sort(currOpt);
Info<< "OptimisationSwitches: " << currOpt << endl;
}
Info<< "done" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -943,7 +943,7 @@ Tolerances
slidingEdgeEndCutoffTol 0.0001;
slidingEdgeCoPlanarTol 0.8;
// GGIAreaErrorTol 1e-8;
GGIAreaErrorTol 1e-8;
}
DimensionedConstants
@ -960,7 +960,7 @@ DimensionedConstants
Tstd 298.15;
//- Stefan-Boltzmann constant [J/(K4 m2 s)]
sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 5.670e-08;
sigmaSB 5.670e-08;
/* USCS units

View file

@ -320,7 +320,7 @@ bool Pstream::init(int& argc, char**& argv)
Info<< "GAMMA Pstream initialized with:" << nl
<< " floatTransfer : " << floatTransfer << nl
<< " nProcsSimpleSum : " << nProcsSimpleSum << nl
<< " nProcsSimpleSum : " << nProcsSimpleSum() << nl
<< " scheduledTransfer : " << Pstream::scheduledTransfer << nl
<< Foam::endl;

View file

@ -156,7 +156,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
return;
}
if (Pstream::nProcs() <= Pstream::nProcsSimpleSum)
if (Pstream::nProcs() <= Pstream::nProcsSimpleSum())
{
if (Pstream::master())
{

View file

@ -30,10 +30,9 @@ Description
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved
\*---------------------------------------------------------------------------*/
\*----------------------------------------------------------------------------*/
#include "coupledLduMatrix.H"
#include "processorLduInterfaceField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -43,6 +42,9 @@ namespace Foam
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct given size
@ -288,7 +290,7 @@ void Foam::coupledLduMatrix::initMatrixInterfaces
matrices[rowI],
coupleCoeffs[rowI][interfaceI],
cmpt,
Pstream::defaultCommsType,
static_cast<const Pstream::commsTypes>(Pstream::defaultCommsType()),
false
);
}
@ -324,4 +326,13 @@ void Foam::coupledLduMatrix::updateMatrixInterfaces
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// ************************************************************************* //

View file

@ -42,14 +42,16 @@ extern "C"
defineTypeNameAndDebug(Foam::mgMeshLevel, 0);
Foam::label Foam::mgMeshLevel::mgMinClusterSize_
const Foam::debug::optimisationSwitch Foam::mgMeshLevel::mgMinClusterSize_
(
debug::optimisationSwitch("mgMinClusterSize", 2)
"mgMinClusterSize",
2
);
Foam::label Foam::mgMeshLevel::mgMaxClusterSize_
const Foam::debug::optimisationSwitch Foam::mgMeshLevel::mgMaxClusterSize_
(
debug::optimisationSwitch("mgMaxClusterSize", 8)
"mgMaxClusterSize",
8
);
@ -173,8 +175,8 @@ void Foam::mgMeshLevel::makeChild() const
const_cast<scalar*>(boundaryAreas.begin()),
cellCells.begin(),
faceWeights.begin(),
mgMinClusterSize_,
mgMaxClusterSize_,
mgMinClusterSize_(),
mgMaxClusterSize_(),
options.begin(),
&nMoves,
&nCoarseCells,

View file

@ -90,10 +90,10 @@ public:
// Coarsening parameters
//- Minimum cluster size
static label mgMinClusterSize_;
static const Foam::debug::optimisationSwitch mgMinClusterSize_;
//- Maximum cluster size
static label mgMaxClusterSize_;
static const Foam::debug::optimisationSwitch mgMaxClusterSize_;
// Constructor

View file

@ -67,7 +67,11 @@ defineTypeNameAndDebug(coupleMap, 0);
//! \cond fileScope
// Geometric relative match tolerance
static scalar geomMatchTol_ = 1e-4;
static const Foam::debug::tolerancesSwitch geomMatchTol_
(
"geomMatchTol",
1e-4
);
// Priority scheme enumerants
enum priorityScheme
@ -1789,7 +1793,7 @@ const changeMap dynamicTopoFvMesh::insertCells(const label mIndex)
{
scalar dist = mag(fC - pts[ptI]);
if (dist < (geomMatchTol_ * tol))
if (dist < (geomMatchTol_() * tol))
{
// Face was converted before
if (debug > 3)
@ -1938,7 +1942,7 @@ const changeMap dynamicTopoFvMesh::insertCells(const label mIndex)
// Specify a merge tolerance for insertion points
scalar mergeTol =
(
is2D() ? 0.0 : geomMatchTol_ * magSqr(edges_[mIndex].vec(points_))
is2D() ? 0.0 : geomMatchTol_() * magSqr(edges_[mIndex].vec(points_))
);
// Check for point / edge processor connections
@ -3228,7 +3232,7 @@ const changeMap dynamicTopoFvMesh::insertCells(const label mIndex)
scalar tol = mag(mesh.points_[fCheck[0]] - fC);
scalar dist = mag(fC - newCentre);
if (dist < (geomMatchTol_ * tol))
if (dist < (geomMatchTol_() * tol))
{
replaceFace = faceI;
break;
@ -5270,7 +5274,7 @@ void dynamicTopoFvMesh::syncCoupledPatches(labelHashSet& entities)
scalar tol = mag(points_[fCheck[0]] - fC);
scalar dist = mag(fC - newCentre);
if (dist < (geomMatchTol_ * tol))
if (dist < (1e-4 * tol))
{
localIndex = faceI;
break;
@ -5320,7 +5324,7 @@ void dynamicTopoFvMesh::syncCoupledPatches(labelHashSet& entities)
scalar dist = mag(fC - newCentre);
// Ensure a face-match
if (dist > (geomMatchTol_ * tol))
if (dist > (geomMatchTol_() * tol))
{
Pout<< " * * * Sync Operations * * * " << nl
<< " Convert patch Op failed." << nl
@ -5330,7 +5334,7 @@ void dynamicTopoFvMesh::syncCoupledPatches(labelHashSet& entities)
<< " faceCentre: " << fC << nl
<< " Master processor: " << proc << nl
<< " procPatch: " << procPatch << nl
<< " tolerance: " << (geomMatchTol_ * tol) << nl
<< " tolerance: " << (geomMatchTol_() * tol) << nl
<< " distance: " << dist << nl
<< " pointCounter: " << pointCounter << nl
<< " newCentre: " << newCentre << nl
@ -5695,7 +5699,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
scalar rMagSf = mag(half1Areas[faceI]);
scalar avSf = 0.5 * (fMagSf + rMagSf);
if (mag(fMagSf - rMagSf)/avSf > geomMatchTol_)
if (mag(fMagSf - rMagSf)/avSf > geomMatchTol_())
{
misMatchError = true;
@ -5713,7 +5717,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
Foam::max
(
pTol,
geomMatchTol_ * mag(lP[lF[faceI][0]] - lC[faceI])
geomMatchTol_() * mag(lP[lF[faceI][0]] - lC[faceI])
)
);
}
@ -5859,7 +5863,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
scalar nbrMagSf = mag(fAreas[pI][faceI]);
scalar avSf = 0.5 * (magSf + nbrMagSf);
if (mag(magSf - nbrMagSf)/avSf > geomMatchTol_)
if (mag(magSf - nbrMagSf)/avSf > geomMatchTol_())
{
misMatchError = true;
@ -5878,7 +5882,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
Foam::max
(
pTol,
geomMatchTol_ *
geomMatchTol_() *
mag
(
myPoints[myFaces[faceI][0]]
@ -6739,7 +6743,7 @@ void dynamicTopoFvMesh::buildLocalCoupledMaps()
const boundBox& box = polyMesh::bounds();
// Compute tolerance
scalar tol = geomMatchTol_ * box.mag();
scalar tol = geomMatchTol_()*box.mag();
const polyBoundaryMesh& boundary = boundaryMesh();
@ -6801,7 +6805,7 @@ void dynamicTopoFvMesh::buildLocalCoupledMaps()
FatalErrorIn("void dynamicTopoFvMesh::buildLocalCoupledMaps()")
<< " Failed to match all points"
<< " within a tolerance of: " << tol << nl
<< " matchTol: " << geomMatchTol_ << nl
<< " matchTol: " << geomMatchTol_() << nl
<< abort(FatalError);
}
@ -7464,7 +7468,7 @@ void dynamicTopoFvMesh::buildProcessorCoupledMaps()
const Map<label>& pMap = cMap.entityMap(coupleMap::POINT);
// Compute tolerance
scalar tol = geomMatchTol_ * box.mag();
scalar tol = geomMatchTol_()*box.mag();
forAllConstIter(Map<label>, pMap, pIter)
{
@ -8761,7 +8765,7 @@ bool dynamicTopoFvMesh::syncCoupledBoundaryOrdering
maxLen = max(maxLen, mag(points_[sFace[fpI]] - sfc));
}
slaveTols[slavePatch][fI] = geomMatchTol_ * maxLen;
slaveTols[slavePatch][fI] = geomMatchTol_()*maxLen;
}
// For cyclics, additionally test for halves,
@ -9115,7 +9119,7 @@ bool dynamicTopoFvMesh::syncCoupledBoundaryOrdering
maxLen = max(maxLen, mag(points_[checkFace[fpI]] - fc));
}
slaveTols[pI][fI] = geomMatchTol_ * maxLen;
slaveTols[pI][fI] = geomMatchTol_()*maxLen;
}
// Write out my centres to disk

View file

@ -47,12 +47,13 @@ Author
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::scalar Foam::slidingInterface::edgeCoPlanarTol_
const Foam::debug::tolerancesSwitch
Foam::slidingInterface::edgeCoPlanarTol_
(
debug::tolerances("slidingEdgeCoPlanarTol", 0.8)
"slidingEdgeCoPlanarTol",
0.8
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Index of debug signs:
@ -636,8 +637,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
if
(
cutOnMaster > edgeEndCutoffTol_
&& cutOnMaster < 1.0 - edgeEndCutoffTol_
cutOnMaster > edgeEndCutoffTol_()
&& cutOnMaster < 1.0 - edgeEndCutoffTol_()
)
{
// Master is cut, check the slave
@ -663,7 +664,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
// Calculate merge tolerance from the
// target edge length
scalar mergeTol =
edgeCoPlanarTol_*mag(b - a);
edgeCoPlanarTol_()*mag(b - a);
// Pout<< "cutOnMaster: " << cutOnMaster
// << " masterCutPoint: " << masterCutPoint
// << " slaveCutPoint: " << slaveCut.hitPoint()
@ -676,8 +677,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
// << endl;
if
(
cutOnSlave > edgeEndCutoffTol_
&& cutOnSlave < 1.0 - edgeEndCutoffTol_
cutOnSlave > edgeEndCutoffTol_()
&& cutOnSlave < 1.0 - edgeEndCutoffTol_()
&& slaveCut.distance() < mergeTol
)
{

View file

@ -631,8 +631,8 @@ void Foam::slidingInterface::modifyMotionPoints(pointField& motionPoints) const
if
(
cutOnMaster > edgeEndCutoffTol_
&& cutOnMaster < 1.0 - edgeEndCutoffTol_
cutOnMaster > edgeEndCutoffTol_()
&& cutOnMaster < 1.0 - edgeEndCutoffTol_()
)
{
// Master is cut, check the slave
@ -658,12 +658,12 @@ void Foam::slidingInterface::modifyMotionPoints(pointField& motionPoints) const
// Calculate merge tolerance from the
// target edge length
scalar mergeTol =
edgeCoPlanarTol_*mag(b - a);
edgeCoPlanarTol_()*mag(b - a);
if
(
cutOnSlave > edgeEndCutoffTol_
&& cutOnSlave < 1.0 - edgeEndCutoffTol_
cutOnSlave > edgeEndCutoffTol_()
&& cutOnSlave < 1.0 - edgeEndCutoffTol_()
&& slaveCut.distance() < mergeTol
)
{

View file

@ -63,6 +63,7 @@ SourceFiles
#include "ZoneIDs.H"
#include "intersection.H"
#include "Pair.H"
#include "tolerancesSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -261,28 +262,28 @@ private:
// Static data members
//- Point merge tolerance
static const scalar pointMergeTol_;
static const Foam::debug::tolerancesSwitch pointMergeTol_;
//- Edge merge tolerance
static const scalar edgeMergeTol_;
static const Foam::debug::tolerancesSwitch edgeMergeTol_;
//- Estimated number of faces an edge goes through
static const label nFacesPerSlaveEdge_;
static const Foam::label nFacesPerSlaveEdge_;
//- Edge-face interaction escape limit
static const label edgeFaceEscapeLimit_;
static const Foam::label edgeFaceEscapeLimit_;
//- Integral match point adjustment tolerance
static const scalar integralAdjTol_;
static const Foam::debug::tolerancesSwitch integralAdjTol_;
//- Edge intersection master catch fraction
static const scalar edgeMasterCatchFraction_;
static const Foam::debug::tolerancesSwitch edgeMasterCatchFraction_;
//- Edge intersection co-planar tolerance
static const scalar edgeCoPlanarTol_;
static const Foam::debug::tolerancesSwitch edgeCoPlanarTol_;
//- Edge end cut-off tolerance
static const scalar edgeEndCutoffTol_;
static const Foam::debug::tolerancesSwitch edgeEndCutoffTol_;
public:

View file

@ -44,31 +44,42 @@ Author
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::scalar Foam::slidingInterface::pointMergeTol_
const Foam::debug::tolerancesSwitch
Foam::slidingInterface::pointMergeTol_
(
debug::tolerances("slidingPointMergeTol", 0.2)
"slidingPointMergeTol",
0.2
);
const Foam::scalar Foam::slidingInterface::edgeMergeTol_
const Foam::debug::tolerancesSwitch
Foam::slidingInterface::edgeMergeTol_
(
debug::tolerances("slidingEdgeMergeTol", 0.05)
"slidingEdgeMergeTol",
0.05
);
const Foam::scalar Foam::slidingInterface::integralAdjTol_
const Foam::debug::tolerancesSwitch
Foam::slidingInterface::integralAdjTol_
(
debug::tolerances("slidingIntegralAdjTol", 0.15)
"slidingIntegralAdjTol",
0.15
);
const Foam::scalar Foam::slidingInterface::edgeMasterCatchFraction_
const Foam::debug::tolerancesSwitch
Foam::slidingInterface::edgeMasterCatchFraction_
(
debug::tolerances("slidingEdgeMasterCatchFraction", 0.4)
"slidingEdgeMasterCatchFraction",
0.4
);
const Foam::scalar Foam::slidingInterface::edgeEndCutoffTol_
const Foam::debug::tolerancesSwitch
Foam::slidingInterface::edgeEndCutoffTol_
(
debug::tolerances("slidingEdgeEndCutoffTol", 0.0001)
"slidingEdgeEndCutoffTol",
0.0001
);
const Foam::label Foam::slidingInterface::nFacesPerSlaveEdge_ = 5;
// Increased limit for extreme 20-1 cutting. HJ, 19/Dec/2008
@ -105,7 +116,13 @@ bool Foam::slidingInterface::projectPoints() const
<< name() << " : "
<< "Projecting slave points onto master surface using ";
if (debug::optimisationSwitch("nSquaredProjection", 0) > 0)
const Foam::debug::optimisationSwitch nSquaredProjection
(
"nSquaredProjection",
0
);
if (nSquaredProjection() > 0)
{
Pout<< "N-squared point projection" << endl;
}
@ -361,7 +378,7 @@ bool Foam::slidingInterface::projectPoints() const
// Calculate the tolerance
const scalar mergeTol =
integralAdjTol_*minSlavePointLength[pointI];
integralAdjTol_()*minSlavePointLength[pointI];
// Adjust the hit
if (mag(nearPoint - missPoint) < mergeTol)
@ -579,7 +596,7 @@ bool Foam::slidingInterface::projectPoints() const
// Calculate the tolerance
const scalar mergeTol =
pointMergeTol_*
pointMergeTol_()*
min
(
minSlavePointLength[pointI],
@ -681,7 +698,7 @@ bool Foam::slidingInterface::projectPoints() const
minMasterFaceLength[slavePointFaceHits[pointI].hitObject()]
);
const scalar mergeTol = pointMergeTol_*mergeLength;
const scalar mergeTol = pointMergeTol_()*mergeLength;
scalar minDistance = GREAT;
@ -742,7 +759,7 @@ bool Foam::slidingInterface::projectPoints() const
// Calculate the tolerance
const scalar mergeTol =
pointMergeTol_*
pointMergeTol_()*
min
(
minSlavePointLength[pointI],
@ -1054,7 +1071,7 @@ bool Foam::slidingInterface::projectPoints() const
// Calculated as a combination of travel distance in projection and
// edge length
scalar slaveCatchDist =
edgeMasterCatchFraction_*edgeMag
edgeMasterCatchFraction_()*edgeMag
+ 0.5*
(
mag
@ -1147,9 +1164,9 @@ bool Foam::slidingInterface::projectPoints() const
// Not a point hit, check for edge
if
(
cutOnSlave > edgeEndCutoffTol_
&& cutOnSlave < 1.0 - edgeEndCutoffTol_ // check edge cut
&& distInEdgePlane < edgeMergeTol_*edgeMag // merge plane
cutOnSlave > edgeEndCutoffTol_()
&& cutOnSlave < 1.0 - edgeEndCutoffTol_() // check edge cut
&& distInEdgePlane < edgeMergeTol_()*edgeMag // merge plane
&& edgeLineHit.distance()
< min
(

View file

@ -34,9 +34,11 @@ const Foam::label Foam::polyTopoChange::pointFraction = 10;
const Foam::label Foam::polyTopoChange::faceFraction = 10;
const Foam::label Foam::polyTopoChange::cellFraction = 10;
int Foam::polyTopoChange::debug
Foam::debug::debugSwitch
Foam::polyTopoChange::debug
(
Foam::debug::debugSwitch("polyTopoChange", 0)
"polyTopoChange",
0
);

View file

@ -121,7 +121,7 @@ class polyTopoChange
public:
static int debug;
static debug::debugSwitch debug;
// Constructors

View file

@ -38,6 +38,7 @@ Description
#include "wedgeFaPatch.H"
#include "faPatchData.H"
#include "SortableList.H"
#include "controlSwitches.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -48,11 +49,14 @@ namespace Foam
Foam::word Foam::faMesh::meshSubDir = "faMesh";
const bool Foam::faMesh::quadricsFit_
const Foam::debug::optimisationSwitch
Foam::faMesh::quadricsFit_
(
debug::optimisationSwitch("quadricsFit", 0) > 0
"quadricsFit",
0
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::faMesh::setPrimitiveMeshData()
@ -1189,7 +1193,7 @@ const Foam::vectorField& Foam::faMesh::pointAreaNormals() const
{
calcPointAreaNormals();
if (quadricsFit_)
if (quadricsFit_() > 0)
{
calcPointAreaNormalsByQuadricsFit();
}

View file

@ -174,7 +174,7 @@ class faMesh
// Static Private Data
static const bool quadricsFit_;
static const Foam::debug::optimisationSwitch quadricsFit_;
// Private Member Functions

View file

@ -38,9 +38,10 @@ namespace Foam
defineTypeNameAndDebug(cyclicFaPatch, 0);
addToRunTimeSelectionTable(faPatch, cyclicFaPatch, dictionary);
const scalar cyclicFaPatch::matchTol_
const Foam::debug::tolerancesSwitch cyclicFaPatch::matchTol_
(
debug::tolerances("patchFaceMatchTol", 1e-3)
"patchFaceMatchTol",
1e-3
);
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -86,7 +87,7 @@ void Foam::cyclicFaPatch::calcTransforms()
else if
(
mag(magLe - nbrMagLe)/avLe
> matchTol_
> matchTol_()
)
{
// Error in area matching. Find largest error
@ -102,7 +103,7 @@ void Foam::cyclicFaPatch::calcTransforms()
}
// Check for error in edge matching
if (maxMatchError > matchTol_)
if (maxMatchError > matchTol_())
{
label nbrEdgei = errorEdge + size()/2;
scalar magLe = mag(half0Normals[errorEdge]);
@ -120,7 +121,7 @@ void Foam::cyclicFaPatch::calcTransforms()
<< "patch:" << name()
<< " my area:" << magLe
<< " neighbour area:" << nbrMagLe
<< " matching tolerance:" << matchTol_
<< " matching tolerance:" << matchTol_()
<< endl
<< "Mesh edge:" << start() + errorEdge
<< endl
@ -175,7 +176,7 @@ void cyclicFaPatch::makeWeights(scalarField& w) const
if
(
mag(magL[edgei] - magL[edgei + sizeby2])/avL
> matchTol_
> matchTol_()
)
{
// Found error. Look for largest matching error
@ -197,7 +198,7 @@ void cyclicFaPatch::makeWeights(scalarField& w) const
}
// Check for error in matching
if (maxMatchError > polyPatch::matchTol_)
if (maxMatchError > polyPatch::matchTol_())
{
scalar avL = (magL[errorEdge] + magL[errorEdge + sizeby2])/2.0;
@ -207,7 +208,7 @@ void cyclicFaPatch::makeWeights(scalarField& w) const
<< 100*mag(magL[errorEdge] - magL[errorEdge + sizeby2])/avL
<< "% -- possible edge ordering problem." << nl
<< "Cyclic area match tolerance = "
<< polyPatch::matchTol_ << " patch: " << name()
<< polyPatch::matchTol_() << " patch: " << name()
<< abort(FatalError);
}
}

View file

@ -38,6 +38,7 @@ SourceFiles
#include "coupledFaPatch.H"
#include "cyclicLduInterface.H"
#include "cyclicPolyPatch.H"
#include "tolerancesSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -65,7 +66,7 @@ protected:
//- Relative tolerance (for geometric matching). Is factor of
// maximum edge length per face.
static const scalar matchTol_;
static const debug::tolerancesSwitch matchTol_;
// Protected Member functions

View file

@ -43,6 +43,7 @@ SourceFiles
#include "faPatch.H"
#include "DimensionedField.H"
#include "debugSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -96,7 +97,7 @@ public:
TypeName("faPatchField");
//- Debug switch to disallow the use of
static int disallowDefaultFaPatchField;
static debug::debugSwitch disallowDefaultFaPatchField;
// Declare run-time constructor selection tables

View file

@ -36,9 +36,11 @@ namespace Foam
\
defineNamedTemplateTypeNameAndDebug(faPatchTypeField, 0); \
template<> \
int faPatchTypeField::disallowDefaultFaPatchField \
Foam::debug::debugSwitch \
faPatchTypeField::disallowDefaultFaPatchField \
( \
debug::debugSwitch("disallowDefaultFaPatchField", 0) \
"disallowDefaultFaPatchField", \
0 \
); \
defineTemplateRunTimeSelectionTable(faPatchTypeField, patch); \
defineTemplateRunTimeSelectionTable(faPatchTypeField, patchMapper); \

View file

@ -43,6 +43,7 @@ SourceFiles
#include "faPatch.H"
#include "DimensionedField.H"
#include "debugSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -93,7 +94,7 @@ public:
TypeName("faePatchField");
//- Debug switch to disallow the use of
static int disallowDefaultFaePatchField;
static debug::debugSwitch disallowDefaultFaePatchField;
// Declare run-time constructor selection tables

View file

@ -39,9 +39,11 @@ namespace Foam
\
defineNamedTemplateTypeNameAndDebug(faePatchTypeField, 0); \
template<> \
int faePatchTypeField::disallowDefaultFaePatchField \
Foam::debug::debugSwitch \
faePatchTypeField::disallowDefaultFaePatchField \
( \
debug::debugSwitch("disallowDefaultFaePatchField", 0) \
"disallowDefaultFaePatchField", \
0 \
); \
defineTemplateRunTimeSelectionTable(faePatchTypeField, patch); \
defineTemplateRunTimeSelectionTable(faePatchTypeField, patchMapper); \

View file

@ -35,7 +35,12 @@ Description
namespace Foam
{
int faSchemes::debug(Foam::debug::debugSwitch("faSchemes", false));
Foam::debug::debugSwitch
faSchemes::debug
(
"faSchemes",
false
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View file

@ -38,6 +38,7 @@ SourceFiles
#define faSchemes_H
#include "IOdictionary.H"
#include "debugSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -90,7 +91,7 @@ private:
public:
//- Debug switch
static int debug;
static debug::debugSwitch debug;
// Constructors

View file

@ -29,6 +29,7 @@ License
#include "processorFvsPatchFields.H"
#include "inletOutletFvPatchFields.H"
#include "fvc.H"
#include "tolerancesSwitch.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
@ -115,8 +116,11 @@ bool Foam::adjustPhi
scalar massCorr = 1.0;
static const scalar closedDomainTol =
debug::tolerances("closedDomainTol", 1e-10);
static const Foam::debug::tolerancesSwitch closedDomainTol
(
"closedDomainTol",
1e-10
);
if (mag(adjustableMassOut) > SMALL)
{
@ -125,7 +129,7 @@ bool Foam::adjustPhi
else if
(
mag(fixedMassOut - massIn)
> closedDomainTol*Foam::max(1.0, mag(massIn))
> closedDomainTol()*Foam::max(1.0, mag(massIn))
)
{
phi.write();

View file

@ -213,7 +213,7 @@ void basicSymmetryFvPatchField<vector>::evaluate(const Pstream::commsTypes)
{
// Local typedefs
typedef vector Type;
typedef outerProduct<vector, Type>::type gradType;
typedef typename outerProduct<vector, Type>::type gradType;
typedef GeometricField<gradType, fvPatchField, volMesh> gradFieldType;
if (!updated())

View file

@ -77,7 +77,7 @@ void directMappedFixedValueFvPatchField<Type>::mapField()
}
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
@ -112,7 +112,7 @@ void directMappedFixedValueFvPatchField<Type>::mapField()
newValues_ = nbrField.boundaryField()[nbrPatchID];
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
@ -144,7 +144,7 @@ void directMappedFixedValueFvPatchField<Type>::mapField()
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),

View file

@ -198,7 +198,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
@ -209,7 +209,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
@ -231,7 +231,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
@ -243,7 +243,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),

View file

@ -46,6 +46,7 @@ SourceFiles
#include "fvPatch.H"
#include "DimensionedField.H"
#include "debugSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -114,7 +115,7 @@ public:
TypeName("fvPatchField");
//- Debug switch to disallow the use of genericFvPatchField
static int disallowGenericFvPatchField;
static debug::debugSwitch disallowGenericFvPatchField;
// Declare run-time constructor selection tables

View file

@ -36,9 +36,11 @@ namespace Foam
\
defineNamedTemplateTypeNameAndDebug(fvPatchTypeField, 0); \
template<> \
int fvPatchTypeField::disallowGenericFvPatchField \
Foam::debug::debugSwitch \
fvPatchTypeField::disallowGenericFvPatchField \
( \
debug::debugSwitch("disallowGenericFvPatchField", 0) \
"disallowGenericFvPatchField", \
0 \
); \
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patch); \
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patchMapper); \

View file

@ -36,9 +36,11 @@ namespace Foam
\
defineNamedTemplateTypeNameAndDebug(fvPatchTypeField, 0); \
template<> \
int fvPatchTypeField::disallowGenericFvPatchField \
debug::debugSwitch \
fvPatchTypeField::disallowGenericFvPatchField \
( \
debug::debugSwitch("disallowGenericFvPatchField", 0) \
"disallowGenericFvPatchField", \
0 \
); \
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patch); \
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patchMapper); \

View file

@ -98,7 +98,7 @@ public:
TypeName("fvsPatchField");
//- Debug switch to disallow the use of
static int disallowDefaultFvsPatchField;
static debug::debugSwitch disallowDefaultFvsPatchField;
// Declare run-time constructor selection tables

View file

@ -36,9 +36,11 @@ namespace Foam
\
defineNamedTemplateTypeNameAndDebug(fvsPatchTypeField, 0); \
template<> \
int fvsPatchTypeField::disallowDefaultFvsPatchField \
Foam::debug::debugSwitch \
fvsPatchTypeField::disallowDefaultFvsPatchField \
( \
debug::debugSwitch("disallowDefaultFvsPatchField", 0) \
"disallowDefaultFvsPatchField", \
0 \
); \
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patch); \
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patchMapper); \

View file

@ -36,9 +36,11 @@ namespace Foam
\
defineNamedTemplateTypeNameAndDebug(fvsPatchTypeField, 0); \
template<> \
int fvsPatchTypeField::disallowDefaultFvsPatchField \
Foam::debug::debugSwitch \
fvsPatchTypeField::disallowDefaultFvsPatchField \
( \
debug::debugSwitch("disallowDefaultFvsPatchField", 0) \
"disallowDefaultFvsPatchField", \
0 \
); \
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patch); \
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patchMapper); \

View file

@ -29,7 +29,12 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
int Foam::fvSchemes::debug(Foam::debug::debugSwitch("fvSchemes", false));
Foam::debug::debugSwitch
Foam::fvSchemes::debug
(
"fvSchemes",
false
);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //

View file

@ -38,6 +38,7 @@ SourceFiles
#define fvSchemes_H
#include "IOdictionary.H"
#include "debugSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -96,7 +97,7 @@ class fvSchemes
public:
//- Debug switch
static int debug;
static debug::debugSwitch debug;
// Constructors

View file

@ -36,9 +36,11 @@ namespace Foam
}
const Foam::scalar Foam::leastSquaresVectors::smallDotProdTol_
const Foam::debug::tolerancesSwitch
Foam::leastSquaresVectors::smallDotProdTol_
(
debug::tolerances("leastSquaresSmallDotProdTol", 0.1)
"leastSquaresSmallDotProdTol",
0.1
);
@ -112,7 +114,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
// Set up temporary storage for the dd tensor (before inversion)
symmTensorField dd(mesh().nCells(), symmTensor::zero);
forAll (owner, faceI)
forAll(owner, faceI)
{
label own = owner[faceI];
label nei = neighbour[faceI];
@ -124,18 +126,18 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
dd[nei] += wdd;
}
forAll (lsP.boundaryField(), patchI)
forAll(lsP.boundaryField(), patchI)
{
const fvPatch& p = mesh().boundary()[patchI];
const unallocLabelList& fc = p.patch().faceCells();
const unallocLabelList& faceCells = p.patch().faceCells();
// Better version of d-vectors: Zeljko Tukovic, 25/Apr/2010
const vectorField pd = p.delta();
forAll (pd, pFaceI)
forAll(pd, patchFaceI)
{
const vector& d = pd[pFaceI];
dd[fc[pFaceI]] += (1.0/magSqr(d))*sqr(d);
const vector& d = pd[patchFaceI];
dd[faceCells[patchFaceI]] += (1.0/magSqr(d))*sqr(d);
}
}
@ -153,25 +155,14 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
),
mesh(),
dimensionedSymmTensor("zero", dimless, symmTensor::zero),
zeroGradientFvPatchScalarField::typeName
"zeroGradient"
);
symmTensorField& invDd = volInvDd.internalField();
// Invert least squares matrix using Householder transformations to avoid
// badly posed cells
// invDd = inv(dd);
invDd = hinv(dd);
// Evaluate coupled to exchange coupled neighbour field data
// across coupled boundaries. HJ, 18/Mar/2015
volInvDd.boundaryField().evaluateCoupled();
// Revisit all faces and calculate the lsP and lsN vectors
vectorField& lsPIn = lsP.internalField();
vectorField& lsNIn = lsN.internalField();
// Least squares vectors on internal faces
forAll (owner, faceI)
forAll(owner, faceI)
{
label own = owner[faceI];
label nei = neighbour[faceI];
@ -179,17 +170,16 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
vector d = C[nei] - C[own];
scalar magSfByMagSqrd = 1.0/magSqr(d);
lsPIn[faceI] = magSfByMagSqrd*(invDd[own] & d);
lsNIn[faceI] = -magSfByMagSqrd*(invDd[nei] & d);
lsP[faceI] = magSfByMagSqrd*(invDd[own] & d);
lsN[faceI] = -magSfByMagSqrd*(invDd[nei] & d);
}
// Least squares vectors on boundary faces
forAll (lsP.boundaryField(), patchI)
forAll(lsP.boundaryField(), patchI)
{
fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI];
fvsPatchVectorField& patchLsN = lsN.boundaryField()[patchI];
const fvPatch& p = mesh().boundary()[patchI];
const unallocLabelList& fc = p.faceCells();
const unallocLabelList& faceCells = p.faceCells();
// Better version of d-vectors: Zeljko Tukovic, 25/Apr/2010
const vectorField pd = p.delta();
@ -199,215 +189,29 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
const symmTensorField invDdNei =
volInvDd.boundaryField()[patchI].patchNeighbourField();
forAll (pd, pFaceI)
forAll(pd, patchFaceI)
{
const vector& d = pd[pFaceI];
const vector& d = pd[patchFaceI];
patchLsP[pFaceI] = (1.0/magSqr(d))*(invDd[fc[pFaceI]] & d);
patchLsP[patchFaceI] = (1.0/magSqr(d))
*(invDd[faceCells[patchFaceI]] & d);
patchLsN[pFaceI] = - (1.0/magSqr(d))*(invDdNei[pFaceI] & d);
patchLsN[patchFaceI] = - (1.0/magSqr(d))
*(invDdNei[faceCells[patchFaceI]] & d);
}
}
else
{
forAll (pd, pFaceI)
forAll(pd, patchFaceI)
{
const vector& d = pd[pFaceI];
const vector& d = pd[patchFaceI];
patchLsP[pFaceI] = (1.0/magSqr(d))*(invDd[fc[pFaceI]] & d);
patchLsP[patchFaceI] = (1.0/magSqr(d))
*(invDd[faceCells[patchFaceI]] & d);
}
}
}
# if 0
// Coefficient sign correction on least squares vectors
// The sign of the coefficient must be positive to ensure correct
// behaviour in coupled systems. This is checked by evaluating
// dot-product of the P/N vectors with the face area vector.
// If the dot-product is negative, cell is marked for use with the
// Gauss gradient, which is unconditionally positive
// HJ, 21/Apr/2015
// First loop: detect cells with bad least squares vectors
Info<< "NEW LEAST SQUARES VECTORS" << endl;
// Use Gauss Gradient field: set to 1 if Gauss is needed
volScalarField useGaussGrad
(
IOobject
(
"useGaussGrad",
mesh().pointsInstance(),
mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh(),
dimensionedScalar("zero", dimVolume, 0),
zeroGradientFvPatchScalarField::typeName
);
const surfaceVectorField& Sf = mesh().Sf();
const surfaceScalarField& w = mesh().weights();
const vectorField& SfIn = Sf.internalField();
const scalarField& wIn = w.internalField();
scalarField& uggIn = useGaussGrad.internalField();
// Check internal faces
forAll (owner, faceI)
{
if
(
(lsPIn[faceI] & SfIn[faceI])/(mag(lsPIn[faceI])*mag(SfIn[faceI]))
< smallDotProdTol_
)
{
// Least square points in the wrong direction for owner
// Use Gauss gradient
uggIn[owner[faceI]] = 1;
}
if
(
(lsNIn[faceI] & SfIn[faceI])/(mag(lsNIn[faceI])*mag(SfIn[faceI]))
> -smallDotProdTol_
)
{
// Least square points in the wrong direction for owner.
// Note that Sf points into neighbour cell
// Use Gauss gradient
uggIn[neighbour[faceI]] = 1;
}
}
forAll (lsP.boundaryField(), patchI)
{
fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI];
const vectorField& pSf = Sf.boundaryField()[patchI];
const fvPatch& p = mesh().boundary()[patchI];
const unallocLabelList& fc = p.faceCells();
// Same check for coupled and uncoupled
forAll (patchLsP, pFaceI)
{
if
(
(patchLsP[pFaceI] & pSf[pFaceI])/
(mag(patchLsP[pFaceI])*mag(pSf[pFaceI]))
< smallDotProdTol_
)
{
uggIn[fc[pFaceI]] = 1;
}
}
}
// Update boundary conditions for coupled boundaries. This synchronises
// the Gauss grad indication field
useGaussGrad.boundaryField().evaluateCoupled();
// Replace least square vectors with weighted Gauss gradient vectors
// for marked cells
// Prepare cell volumes with parallel communications
volScalarField cellV
(
IOobject
(
"cellV",
mesh().pointsInstance(),
mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh(),
dimensionedScalar("zero", dimVolume, 0),
zeroGradientFvPatchScalarField::typeName
);
cellV.internalField() = mesh().V();
// Evaluate coupled to exchange coupled neighbour field data
// across coupled boundaries. HJ, 18/Mar/2015
cellV.boundaryField().evaluateCoupled();
const scalarField& cellVIn = cellV.internalField();
// Internal faces
forAll (owner, faceI)
{
label own = owner[faceI];
label nei = neighbour[faceI];
if (uggIn[own] > SMALL)
{
// Gauss gradient for owner cell
lsPIn[faceI] = (1 - wIn[faceI])*SfIn[faceI]/cellVIn[own];
}
if (uggIn[nei] > SMALL)
{
// Gauss gradient for neighbour cell
lsNIn[faceI] = -wIn[faceI]*SfIn[faceI]/cellVIn[nei];
}
}
// Boundary faces
forAll (lsP.boundaryField(), patchI)
{
fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI];
fvsPatchVectorField& patchLsN = lsN.boundaryField()[patchI];
const fvPatch& p = mesh().boundary()[patchI];
const unallocLabelList& fc = p.faceCells();
const fvsPatchScalarField& pw = w.boundaryField()[patchI];
const vectorField& pSf = Sf.boundaryField()[patchI];
// Get indicator for local side
const fvPatchScalarField& ugg = useGaussGrad.boundaryField()[patchI];
const scalarField pUgg = ugg.patchInternalField();
if (p.coupled())
{
const scalarField cellVInNei =
cellV.boundaryField()[patchI].patchNeighbourField();
// Get indicator for neighbour side
const scalarField nUgg = ugg.patchNeighbourField();
forAll (pUgg, pFaceI)
{
if (pUgg[pFaceI] > SMALL)
{
// Gauss grad for owner cell
patchLsP[pFaceI] =
(1 - pw[pFaceI])*pSf[pFaceI]/cellVIn[fc[pFaceI]];
}
if (nUgg[pFaceI] > SMALL)
{
// Gauss gradient for neighbour cell
patchLsN[pFaceI] =
-pw[pFaceI]*pSf[pFaceI]/cellVInNei[pFaceI];
}
}
}
else
{
forAll (pUgg, pFaceI)
{
if (pUgg[pFaceI] > SMALL)
{
// Gauss grad for owner cell
patchLsP[pFaceI] =
(1 - pw[pFaceI])*pSf[pFaceI]/cellVIn[fc[pFaceI]];
}
}
}
}
#endif
if (debug)
{
Info<< "leastSquaresVectors::makeLeastSquaresVectors() :"
@ -453,15 +257,12 @@ bool Foam::leastSquaresVectors::movePoints() const
return true;
}
bool Foam::leastSquaresVectors::updateMesh(const mapPolyMesh& mpm) const
{
if (debug)
{
InfoIn
(
"bool leastSquaresVectors::updateMesh(const mapPolyMesh&) const"
) << "Clearing least square data" << endl;
InfoIn("bool leastSquaresVectors::updateMesh(const mapPolyMesh&) const")
<< "Clearing least square data" << endl;
}
deleteDemandDrivenData(pVectorsPtr_);

View file

@ -39,6 +39,7 @@ SourceFiles
#include "fvMesh.H"
#include "surfaceFieldsFwd.H"
#include "labelPair.H"
#include "tolerancesSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -77,7 +78,7 @@ public:
// Static data members
//- Point merge tolerance
static const scalar smallDotProdTol_;
static const Foam::debug::tolerancesSwitch smallDotProdTol_;
// Constructors

View file

@ -63,7 +63,7 @@ void cyclicFvPatch::makeWeights(scalarField& w) const
if
(
mag(magFa[facei] - magFa[facei + sizeby2])/avFa
> polyPatch::matchTol_
> polyPatch::matchTol_()
)
{
// Found error. Look for largest matching error
@ -85,7 +85,7 @@ void cyclicFvPatch::makeWeights(scalarField& w) const
}
// Check for error in matching
if (maxMatchError > polyPatch::matchTol_)
if (maxMatchError > polyPatch::matchTol_())
{
scalar avFa = (magFa[errorFace] + magFa[errorFace + sizeby2])/2.0;
@ -95,7 +95,7 @@ void cyclicFvPatch::makeWeights(scalarField& w) const
<< 100*mag(magFa[errorFace] - magFa[errorFace + sizeby2])/avFa
<< "% -- possible face ordering problem." << nl
<< "Cyclic area match tolerance = "
<< polyPatch::matchTol_ << " patch: " << name()
<< polyPatch::matchTol_() << " patch: " << name()
<< abort(FatalError);
}
}

View file

@ -28,7 +28,12 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
int Foam::cellPointWeight::debug(debug::debugSwitch("cellPointWeight", 0));
Foam::debug::debugSwitch
Foam::cellPointWeight::debug
(
"cellPointWeight",
0
);
Foam::scalar Foam::cellPointWeight::tol(SMALL);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //

View file

@ -84,7 +84,7 @@ protected:
public:
//- Debug switch
static int debug;
static debug::debugSwitch debug;
//- Tolerance used in calculating barycentric co-ordinates
// (applied to normailised values)

View file

@ -3,6 +3,12 @@ global/dimensionedConstants/dimensionedConstants.C
global/argList/argList.C
global/clock/clock.C
global/controlSwitches/debugSwitch.C
global/controlSwitches/infoSwitch.C
global/controlSwitches/optimisationSwitch.C
global/controlSwitches/tolerancesSwitch.C
global/controlSwitches/constantsSwitch.C
global/profiling/profilingInfo.C
global/profiling/profilingPool.C
global/profiling/profilingStack.C

View file

@ -36,15 +36,17 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template <class Type>
Foam::scalar Foam::FaceCellWave<Type>::geomTol_
Foam::debug::tolerancesSwitch Foam::FaceCellWave<Type>::geomTol_
(
debug::tolerances("FaceCellWaveGeomTol", 1e-6)
"FaceCellWaveGeomTol",
1e-6
);
template <class Type>
Foam::scalar Foam::FaceCellWave<Type>::propagationTol_
Foam::debug::tolerancesSwitch Foam::FaceCellWave<Type>::propagationTol_
(
debug::tolerances("FaceCellWavePropagationTol", 0.01)
"FaceCellWavePropagationTol",
0.01
);
// Write to ostream
@ -264,7 +266,7 @@ void Foam::FaceCellWave<Type>::checkCyclic(const polyPatch& patch) const
label i1 = patch.start() + patchFaceI;
label i2 = i1 + cycOffset;
if (!allFaceInfo_[i1].sameGeometry(mesh_, allFaceInfo_[i2], geomTol_))
if (!allFaceInfo_[i1].sameGeometry(mesh_, allFaceInfo_[i2], geomTol_()))
{
FatalErrorIn("FaceCellWave<Type>::checkCyclic(const polyPatch&)")
<< "problem: i:" << i1 << " otheri:" << i2
@ -359,7 +361,7 @@ void Foam::FaceCellWave<Type>::mergeFaceInfo
(
meshFaceI,
neighbourWallInfo,
propagationTol_,
propagationTol_(),
currentWallInfo
);
}
@ -934,7 +936,7 @@ Foam::label Foam::FaceCellWave<Type>::faceToCell()
cellI,
faceI,
neighbourWallInfo,
propagationTol_,
propagationTol_(),
currentWallInfo
);
}
@ -952,7 +954,7 @@ Foam::label Foam::FaceCellWave<Type>::faceToCell()
cellI,
faceI,
neighbourWallInfo,
propagationTol_,
propagationTol_(),
currentWallInfo2
);
}
@ -1018,7 +1020,7 @@ Foam::label Foam::FaceCellWave<Type>::cellToFace()
faceI,
cellI,
neighbourWallInfo,
propagationTol_,
propagationTol_(),
currentWallInfo
);
}

View file

@ -50,6 +50,7 @@ SourceFiles
#include "boolList.H"
#include "labelList.H"
#include "primitiveFieldsFwd.H"
#include "tolerancesSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -267,9 +268,8 @@ class FaceCellWave
// Private static data
static scalar geomTol_;
static scalar propagationTol_;
static debug::tolerancesSwitch geomTol_;
static debug::tolerancesSwitch propagationTol_;
public:
@ -278,7 +278,7 @@ public:
//- Access to tolerance
static scalar propagationTol()
{
return propagationTol_;
return propagationTol_();
}
//- Change tolerance

View file

@ -35,12 +35,13 @@ License
defineTypeNameAndDebug(Foam::octreeDataBoundBox, 0);
Foam::scalar Foam::octreeDataBoundBox::tol
const Foam::debug::tolerancesSwitch
Foam::octreeDataBoundBox::tol
(
debug::tolerances("octreeDataBoundBoxTol", 1e-6)
"octreeDataBoundBoxTol",
1e-6
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::octreeDataBoundBox::octreeDataBoundBox

View file

@ -49,6 +49,7 @@ Author
#include "point.H"
#include "className.H"
#include "linePointRef.H"
#include "tolerancesSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -69,7 +70,7 @@ class octreeDataBoundBox
// Static data
//- Tolerance on linear dimensions
static scalar tol;
static const Foam::debug::tolerancesSwitch tol;
// Private data

View file

@ -120,6 +120,13 @@ public:
return names[e];
}
//- Return the name of the given enumeration element
// where e is specified as a int
const char* operator[](const int e) const
{
return names[e];
}
// Friend operators

View file

@ -36,8 +36,13 @@ namespace Foam
const IOstream::versionNumber IOstream::originalVersion(0.5);
const IOstream::versionNumber IOstream::currentVersion(2.0);
unsigned int IOstream::precision_(debug::infoSwitch("writePrecision", 6));
Foam::debug::infoSwitch
IOstream::precision_
(
"writePrecision",
6
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Global IO streams

View file

@ -49,9 +49,13 @@ SourceFiles
#include "scalar.H"
#include "fileName.H"
#include "InfoProxy.H"
#include "infoSwitch.H"
#include "debug.H"
#include <iostream>
#if __GNUC__ < 3
# define ios_base ios
#endif
@ -211,8 +215,7 @@ public:
static const versionNumber currentVersion;
//- Default precision
static unsigned int precision_;
static Foam::debug::infoSwitch precision_;
private:
@ -466,13 +469,13 @@ public:
//- Return the default precision
static unsigned int defaultPrecision()
{
return precision_;
return precision_();
}
//- Reset the default precision (and return old precision)
static unsigned int defaultPrecision(unsigned int p)
{
unsigned int precision0 = precision_;
unsigned int precision0 = precision_();
precision_ = p;
return precision0;
}

View file

@ -227,23 +227,41 @@ Foam::List<Foam::Pstream::commsStruct> Foam::Pstream::treeCommunication_(0);
// Should compact transfer be used in which floats replace doubles
// reducing the bandwidth requirement at the expense of some loss
// in accuracy
bool Foam::Pstream::floatTransfer
const Foam::debug::optimisationSwitch
Foam::Pstream::floatTransfer
(
debug::optimisationSwitch("floatTransfer", 0)
"floatTransfer",
0
);
// Number of processors at which the reduce algorithm changes from linear to
// tree
int Foam::Pstream::nProcsSimpleSum
const Foam::debug::optimisationSwitch
Foam::Pstream::nProcsSimpleSum
(
debug::optimisationSwitch("nProcsSimpleSum", 16)
"nProcsSimpleSum",
16
);
// Default commsType
Foam::Pstream::commsTypes Foam::Pstream::defaultCommsType
Foam::Pstream::commsTypes Foam::Pstream::defaultCommsType_
(
commsTypeNames.read(debug::optimisationSwitches().lookup("commsType"))
commsTypeNames
[
debug::optimisationSwitches().lookupOrAddDefault
(
"commsType",
word("blocking")
)
]
);
const Foam::debug::optimisationSwitch
Foam::Pstream::defaultCommsType
(
"commsType",
"blocking",
"blocking, nonBlocking, scheduled"
);
// ************************************************************************* //

View file

@ -45,6 +45,7 @@ SourceFiles
#include "HashTable.H"
#include "string.H"
#include "NamedEnum.H"
#include "optimisationSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -224,15 +225,16 @@ public:
//- Should compact transfer be used in which floats replace doubles
// reducing the bandwidth requirement at the expense of some loss
// in accuracy
static bool floatTransfer;
static const Foam::debug::optimisationSwitch floatTransfer;
//- Number of processors at which the sum algorithm changes from linear
// to tree
static int nProcsSimpleSum;
static const Foam::debug::optimisationSwitch nProcsSimpleSum;
//- Default commsType
static commsTypes defaultCommsType;
static commsTypes defaultCommsType_;
static const Foam::debug::optimisationSwitch defaultCommsType;
// Constructors

View file

@ -62,7 +62,7 @@ void combineReduce
template <class T, class CombineOp>
void combineReduce(T& Value, const CombineOp& cop)
{
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
Pstream::combineGather(Pstream::linearCommunication(), Value, cop);
Pstream::combineScatter(Pstream::linearCommunication(), Value);

View file

@ -58,7 +58,7 @@ void reduce
const BinaryOp& bop
)
{
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
reduce(Pstream::linearCommunication(), Value, bop);
}
@ -79,7 +79,7 @@ T returnReduce
{
T WorkValue(Value);
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
reduce(Pstream::linearCommunication(), WorkValue, bop);
}

View file

@ -129,7 +129,7 @@ void Pstream::combineGather
template <class T, class CombineOp>
void Pstream::combineGather(T& Value, const CombineOp& cop)
{
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
combineGather(Pstream::linearCommunication(), Value, cop);
}
@ -207,7 +207,7 @@ void Pstream::combineScatter(const List<Pstream::commsStruct>& comms, T& Value)
template <class T>
void Pstream::combineScatter(T& Value)
{
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
combineScatter(Pstream::linearCommunication(), Value);
}
@ -313,7 +313,7 @@ void Pstream::listCombineGather
template <class T, class CombineOp>
void Pstream::listCombineGather(List<T>& Values, const CombineOp& cop)
{
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
listCombineGather(Pstream::linearCommunication(), Values, cop);
}
@ -395,7 +395,7 @@ void Pstream::listCombineScatter
template <class T>
void Pstream::listCombineScatter(List<T>& Values)
{
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
listCombineScatter(Pstream::linearCommunication(), Values);
}
@ -480,7 +480,7 @@ void Pstream::mapCombineGather
template <class Container, class CombineOp>
void Pstream::mapCombineGather(Container& Values, const CombineOp& cop)
{
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
mapCombineGather(Pstream::linearCommunication(), Values, cop);
}
@ -536,7 +536,7 @@ void Pstream::mapCombineScatter
template <class Container>
void Pstream::mapCombineScatter(Container& Values)
{
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
mapCombineScatter(Pstream::linearCommunication(), Values);
}

View file

@ -103,7 +103,7 @@ void Pstream::gather
template <class T, class BinaryOp>
void Pstream::gather(T& Value, const BinaryOp& bop)
{
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
gather(Pstream::linearCommunication(), Value, bop);
}
@ -168,7 +168,7 @@ void Pstream::scatter(const List<Pstream::commsStruct>& comms, T& Value)
template <class T>
void Pstream::scatter(T& Value)
{
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
scatter(Pstream::linearCommunication(), Value);
}

View file

@ -180,7 +180,7 @@ void Pstream::gatherList
template <class T>
void Pstream::gatherList(List<T>& Values)
{
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
gatherList(Pstream::linearCommunication(), Values);
}
@ -305,7 +305,7 @@ void Pstream::scatterList
template <class T>
void Pstream::scatterList(List<T>& Values)
{
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
{
scatterList(Pstream::linearCommunication(), Values);
}

View file

@ -44,7 +44,7 @@ inline Foam::OSstream::OSstream
{
setOpened();
setGood();
os_.precision(precision_);
os_.precision(precision_());
}
else
{

View file

@ -33,6 +33,9 @@ License
void Foam::Time::readDict()
{
if (debug)
Info << "Time::readDict(): reading " << controlDict_.name() << endl;
if (!deltaTchanged_)
{
deltaT_ = readScalar(controlDict_.lookup("deltaT"));

View file

@ -37,7 +37,12 @@ const Foam::word Foam::functionEntries::includeEntry::typeName
// Don't lookup the debug switch here as the debug switch dictionary
// might include includeEntry
int Foam::functionEntries::includeEntry::debug(0);
Foam::debug::debugSwitch
Foam::functionEntries::includeEntry::debug
(
"includeEntry",
0
);
namespace Foam
{

View file

@ -37,7 +37,12 @@ const Foam::word Foam::functionEntries::includeIfPresentEntry::typeName
// Don't lookup the debug switch here as the debug switch dictionary
// might include includeIfPresentEntry
int Foam::functionEntries::includeIfPresentEntry::debug(0);
Foam::debug::debugSwitch
Foam::functionEntries::includeIfPresentEntry::debug
(
"includeIfPresentEntry",
0
);
namespace Foam
{

View file

@ -36,7 +36,12 @@ const Foam::word Foam::functionEntries::inputModeEntry::typeName
// Don't lookup the debug switch here as the debug switch dictionary
// might include inputModeEntries
int Foam::functionEntries::inputModeEntry::debug(0);
Foam::debug::debugSwitch
Foam::functionEntries::inputModeEntry::debug
(
"inputModeEntry",
0
);
Foam::functionEntries::inputModeEntry::inputMode
Foam::functionEntries::inputModeEntry::mode_(MERGE);

View file

@ -39,7 +39,12 @@ const Foam::word Foam::functionEntries::removeEntry::typeName
// Don't lookup the debug switch here as the debug switch dictionary
// might include removeEntry
int Foam::functionEntries::removeEntry::debug(0);
Foam::debug::debugSwitch
Foam::functionEntries::removeEntry::debug
(
"removeEntry",
0
);
namespace Foam
{

View file

@ -29,7 +29,12 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
int Foam::messageStream::level(Foam::debug::debugSwitch("level", 2));
Foam::debug::debugSwitch
Foam::messageStream::level
(
"level",
2
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -48,6 +48,7 @@ SourceFiles
#include "label.H"
#include "string.H"
#include "debugSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -93,7 +94,7 @@ public:
// Debug switches
static int level;
static debug::debugSwitch level;
// Constructors

View file

@ -30,7 +30,13 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineRunTimeSelectionTable(Foam::functionObject, dictionary);
int Foam::functionObject::debug(Foam::debug::debugSwitch("functionObject", 0));
Foam::debug::debugSwitch
Foam::functionObject::debug
(
"functionObject",
0
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View file

@ -41,6 +41,7 @@ SourceFiles
#include "typeInfo.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "debugSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -76,7 +77,7 @@ public:
//- Runtime type information
virtual const word& type() const = 0;
static int debug;
static debug::debugSwitch debug;
// Declare run-time constructor selection tables

View file

@ -31,12 +31,13 @@ License
defineTypeNameAndDebug(Foam::regIOobject, 0);
int Foam::regIOobject::fileModificationSkew
const Foam::debug::optimisationSwitch
Foam::regIOobject::fileModificationSkew
(
Foam::debug::optimisationSwitch("fileModificationSkew", 30)
"fileModificationSkew",
30
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from IOobject

View file

@ -41,6 +41,7 @@ SourceFiles
#include "IOobject.H"
#include "typeInfo.H"
#include "OSspecific.H"
#include "optimisationSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -93,7 +94,7 @@ public:
//- Runtime type information
TypeName("regIOobject");
static int fileModificationSkew;
static const Foam::debug::optimisationSwitch fileModificationSkew;
// Constructors

View file

@ -154,7 +154,7 @@ bool Foam::regIOobject::modified() const
return
(
lastModified_
&& lastModified(filePath()) > (lastModified_ + fileModificationSkew)
&& lastModified(filePath()) > (lastModified_ + fileModificationSkew())
);
}
@ -167,7 +167,7 @@ bool Foam::regIOobject::readIfModified()
bool readFile = false;
if (newTimeStamp > (lastModified_ + fileModificationSkew))
if (newTimeStamp > (lastModified_ + fileModificationSkew()))
{
readFile = true;
}

View file

@ -28,7 +28,12 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
int Foam::scalarRange::debug(::Foam::debug::debugSwitch("scalarRange", 0));
Foam::debug::debugSwitch
Foam::scalarRange::debug
(
"scalarRange",
0
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View file

@ -40,6 +40,7 @@ SourceFiles
#define scalarRange_H
#include "scalar.H"
#include "debugSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -82,7 +83,7 @@ class scalarRange
public:
static int debug;
static debug::debugSwitch debug;
// Constructors

View file

@ -31,6 +31,7 @@ Description
#include "word.H"
#include "debug.H"
#include "debugSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,13 +73,13 @@ public: \
// Also declares debug information.
#define ClassName(TypeNameString) \
ClassNameNoDebug(TypeNameString); \
static int debug
static Foam::debug::debugSwitch debug;
//- Add typeName information from argument @a TypeNameString to a namespace.
// Also declares debug information.
#define NamespaceName(TypeNameString) \
NamespaceNameNoDebug(TypeNameString); \
extern int debug
extern Foam::debug::debugSwitch debug;
//- Add typeName information from argument @a TypeNameString to a template class.
// Also declares debug information.
@ -132,22 +133,24 @@ public: \
//- Define the debug information, lookup as @a Name
#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch))
#define defineDebugSwitchWithName(Type, Name, DebugSwitch, SwitchDescr) \
::Foam::debug::debugSwitch \
Type::debug(std::string(Name), DebugSwitch, SwitchDescr)
//- Define the debug information
#define defineDebugSwitch(Type, DebugSwitch) \
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
#define defineDebugSwitch(Type, DebugSwitch, SwitchDescr) \
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch, SwitchDescr);
#ifdef __INTEL_COMPILER
//- Define the debug information for templates, lookup as @a Name
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
defineDebugSwitchWithName(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)
defineDebugSwitchWithName(Type, Name, DebugSwitch, "");
#endif
//- Define the debug information for templates
@ -169,7 +172,12 @@ public: \
//- Define the typeName and debug information
#define defineTypeNameAndDebug(Type, DebugSwitch) \
defineTypeName(Type); \
defineDebugSwitch(Type, DebugSwitch)
defineDebugSwitch(Type, DebugSwitch, "")
//- Define the typeName and debug information + description
#define defineTypeNameAndDebugWithDescription(Type, DebugSwitch, SwitchDescr) \
defineTypeName(Type); \
defineDebugSwitch(Type, DebugSwitch, SwitchDescr)
//- Define the typeName and debug information, lookup as @a Name
#define defineTemplateTypeNameAndDebugWithName(Type, Name, DebugSwitch) \

View file

@ -293,7 +293,10 @@ evaluate()
{
forAll(*this, patchi)
{
this->operator[](patchi).initEvaluate(Pstream::defaultCommsType);
this->operator[](patchi).initEvaluate
(
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType())
);
}
// Block for any outstanding requests
@ -305,7 +308,10 @@ evaluate()
forAll(*this, patchi)
{
this->operator[](patchi).evaluate(Pstream::defaultCommsType);
this->operator[](patchi).evaluate
(
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType())
);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
@ -331,7 +337,7 @@ evaluate()
{
FatalErrorIn("GeometricBoundaryField::evaluate()")
<< "Unsuported communications type "
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
<< exit(FatalError);
}
}
@ -360,7 +366,7 @@ evaluateCoupled()
{
this->operator[](patchi).initEvaluate
(
Pstream::defaultCommsType
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType())
);
}
}
@ -376,7 +382,10 @@ evaluateCoupled()
{
if (this->operator[](patchi).coupled())
{
this->operator[](patchi).evaluate(Pstream::defaultCommsType);
this->operator[](patchi).evaluate
(
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType())
);
}
}
}
@ -415,7 +424,7 @@ evaluateCoupled()
{
FatalErrorIn("GeometricBoundaryField::evaluateCoupled()")
<< "Unsuported communications type "
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
<< exit(FatalError);
}
}

View file

@ -31,7 +31,13 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
bool Foam::JobInfo::writeJobInfo(Foam::debug::infoSwitch("writeJobInfo", 0));
Foam::debug::infoSwitch
Foam::JobInfo::writeJobInfo
(
"writeJobInfo",
0
);
Foam::JobInfo Foam::jobInfo;

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