Removing trailing whitespace

This commit is contained in:
Henrik Rusche 2015-05-15 15:57:39 +02:00
parent a9fefbe25b
commit ee97417a27
219 changed files with 161323 additions and 161325 deletions

View file

@ -1,5 +1,5 @@
################################################################################ ################################################################################
This file contains brief description of the changes introduced by merging This file contains brief description of the changes introduced by merging
branches branches
There are two secions: feature and bugfix There are two secions: feature and bugfix
@ -31,7 +31,7 @@ Updated wmake/rules for compilation with ICC 14
* processorPointPatch * processorPointPatch
Author: Zeljko Tukovic; Merge: Dominik Christ Author: Zeljko Tukovic; Merge: Dominik Christ
Correct interpolation of point data on processor boundaries after parallel Correct interpolation of point data on processor boundaries after parallel
topological changes topological changes

View file

@ -42,9 +42,9 @@
December 2004) as release number 3.0. Visit http://foam-extend.org December 2004) as release number 3.0. Visit http://foam-extend.org
for more information. for more information.
OPENFOAM® is a registered trademark of ESI Group. OpenFOAM-extend and OPENFOAM® is a registered trademark of ESI Group. OpenFOAM-extend and
foam-extend are a community effort not endorsed by ESI Group. foam-extend are a community effort not endorsed by ESI Group.
** Installation ** Installation
foam-extend-3.1 can be compiled and runs on any linux system foam-extend-3.1 can be compiled and runs on any linux system
@ -68,7 +68,7 @@
Binary packages are available for download at Binary packages are available for download at
http://sourceforge.net/projects/openfoam-extend/ for the following http://sourceforge.net/projects/openfoam-extend/ for the following
systems: Ubuntu 14.04, Fedora 20 and Mac OS X. systems: Ubuntu 14.04, Fedora 20 and Mac OS X.
* Accompanying ThirdParty software: * Accompanying ThirdParty software:
- gcc compatibility up to 4.8.2 - gcc compatibility up to 4.8.2
- Paraview 4.0.1 - Paraview 4.0.1
@ -86,7 +86,7 @@
- bison 2.7 - bison 2.7
- hwloc 1.7.2 - hwloc 1.7.2
- libccmio 2.6.1 - libccmio 2.6.1
** Compatibility ** Compatibility
Upstream features from the OpenFOAM® code base are merged into Upstream features from the OpenFOAM® code base are merged into
foam-extend on regular basis. The interface format of foam-extend on regular basis. The interface format of
@ -328,8 +328,8 @@ user@machine> git log 3.0.. > commitLog
http://sourceforge.net/apps/mantisbt/openfoam-extend http://sourceforge.net/apps/mantisbt/openfoam-extend
** How to contribute ** How to contribute
All your contributions are highly welcome: New solvers, utilities and All your contributions are highly welcome: New solvers, utilities and
models; bug fixes; documentation. The many ways of contributing and the models; bug fixes; documentation. The many ways of contributing and the
contribution process are described in detail at: contribution process are described in detail at:
http://sourceforge.net/p/openfoam-extend/wiki/HowToContribute/ http://sourceforge.net/p/openfoam-extend/wiki/HowToContribute/

View file

@ -19,7 +19,7 @@ Table of Contents
9 List of Contributors: 9 List of Contributors:
1 Overview 1 Overview
----------- -----------
The foam-extend project is a fork of the OpenFOAM® open source The foam-extend project is a fork of the OpenFOAM® open source
library for Computational Fluid Dynamics (CFD). It is an open library for Computational Fluid Dynamics (CFD). It is an open
@ -46,11 +46,11 @@ Table of Contents
December 2004) as release number 3.0. Visit [http://foam-extend.org] December 2004) as release number 3.0. Visit [http://foam-extend.org]
for more information. for more information.
OPENFOAM® is a registered trademark of ESI Group. OpenFOAM-extend and OPENFOAM® is a registered trademark of ESI Group. OpenFOAM-extend and
foam-extend are a community effort not endorsed by ESI Group. foam-extend are a community effort not endorsed by ESI Group.
2 Installation
2 Installation
--------------- ---------------
foam-extend-3.1 can be compiled and runs on any linux system foam-extend-3.1 can be compiled and runs on any linux system
@ -74,7 +74,7 @@ Table of Contents
Binary packages are available for download at Binary packages are available for download at
[http://sourceforge.net/projects/openfoam-extend/] for the following [http://sourceforge.net/projects/openfoam-extend/] for the following
systems: Ubuntu 14.04, Fedora 20 and Mac OS X. systems: Ubuntu 14.04, Fedora 20 and Mac OS X.
* Accompanying ThirdParty software: * Accompanying ThirdParty software:
- gcc compatibility up to 4.8.2 - gcc compatibility up to 4.8.2
- Paraview 4.0.1 - Paraview 4.0.1
@ -92,9 +92,9 @@ Table of Contents
- bison 2.7 - bison 2.7
- hwloc 1.7.2 - hwloc 1.7.2
- libccmio 2.6.1 - libccmio 2.6.1
3 Compatibility
3 Compatibility
---------------- ----------------
Upstream features from the OpenFOAM® code base are merged into Upstream features from the OpenFOAM® code base are merged into
foam-extend on regular basis. The interface format of foam-extend on regular basis. The interface format of
@ -103,7 +103,7 @@ Table of Contents
fixes and algorithmic improvements, considered more important than fixes and algorithmic improvements, considered more important than
inter-operability. inter-operability.
4 Main differentiators between foam-extend and OpenFOAM 4 Main differentiators between foam-extend and OpenFOAM
-------------------------------------------------------- --------------------------------------------------------
A large number of features have been lost within the release of A large number of features have been lost within the release of
OpenFOAM since version 1.3, the code base has shrunk by more than OpenFOAM since version 1.3, the code base has shrunk by more than
@ -184,7 +184,7 @@ Table of Contents
* Approximately 6000 bug fixes in fundamental level libraries and * Approximately 6000 bug fixes in fundamental level libraries and
discretisation techniques discretisation techniques
5 New features in foam-extend-3.1, since foam-extend-3.0 5 New features in foam-extend-3.1, since foam-extend-3.0
--------------------------------------------------------- ---------------------------------------------------------
The list of features is a result of the work of numerous The list of features is a result of the work of numerous
contributors. The maintainers of foam-extend would formally like to contributors. The maintainers of foam-extend would formally like to
@ -307,7 +307,7 @@ Table of Contents
- Template depth for block matrix support - Template depth for block matrix support
- Parallel efficiency improvements - Parallel efficiency improvements
6 Recent successful compilations and tests 6 Recent successful compilations and tests
------------------------------------------- -------------------------------------------
* Ubuntu 14.04: * Ubuntu 14.04:
@ -337,18 +337,18 @@ Table of Contents
[http://openfoam-extend.sourceforge.net/CDash/viewTest.php?buildid=743] [http://openfoam-extend.sourceforge.net/CDash/viewTest.php?buildid=743]
7 Reporting bugs 7 Reporting bugs
----------------- -----------------
To report bugs, please use the MantisBT bugtracker at To report bugs, please use the MantisBT bugtracker at
[http://sourceforge.net/apps/mantisbt/openfoam-extend] [http://sourceforge.net/apps/mantisbt/openfoam-extend]
8 How to contribute 8 How to contribute
-------------------- --------------------
All your contributions are highly welcome: New solvers, utilities and All your contributions are highly welcome: New solvers, utilities and
models; bug fixes; documentation. The many ways of contributing and the models; bug fixes; documentation. The many ways of contributing and the
contribution process are described in detail at: contribution process are described in detail at:
[http://sourceforge.net/p/openfoam-extend/wiki/HowToContribute/] [http://sourceforge.net/p/openfoam-extend/wiki/HowToContribute/]
9 List of Contributors: 9 List of Contributors:
------------------------ ------------------------
See file ListOfContributors See file ListOfContributors

View file

@ -2,7 +2,7 @@ int nCorr = 0;
if (aMesh.solutionDict().found("nOuterCorrectors")) if (aMesh.solutionDict().found("nOuterCorrectors"))
{ {
nCorr = nCorr =
readInt(aMesh.solutionDict().lookup("nOuterCorrectors")); readInt(aMesh.solutionDict().lookup("nOuterCorrectors"));
} }
else else

View file

@ -40,7 +40,7 @@ scalar velMag = 0.0;
if (aMesh.nInternalEdges()) if (aMesh.nInternalEdges())
{ {
edgeScalarField SfUfbyDelta = edgeScalarField SfUfbyDelta =
aMesh.edgeInterpolation::deltaCoeffs()*mag(phis); aMesh.edgeInterpolation::deltaCoeffs()*mag(phis);
CoNum = max(SfUfbyDelta/aMesh.magLe()) CoNum = max(SfUfbyDelta/aMesh.magLe())
@ -53,7 +53,7 @@ if (aMesh.nInternalEdges())
} }
Info<< "Courant Number mean: " << meanCoNum Info<< "Courant Number mean: " << meanCoNum
<< " max: " << CoNum << " max: " << CoNum
<< " velocity magnitude: " << velMag << endl; << " velocity magnitude: " << velMag << endl;
// ************************************************************************* // // ************************************************************************* //

View file

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

View file

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

View file

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

View file

@ -12,7 +12,7 @@ nCoupledFacesToBreak = 0;
// only consider tensile tractions // only consider tensile tractions
normalTraction = max(normalTraction, scalar(0)); normalTraction = max(normalTraction, scalar(0));
scalarField shearTraction = scalarField shearTraction =
cohesiveZone.internalField() * cohesiveZone.internalField() *
mag( (I - Foam::sqr(n.internalField())) & traction.internalField() ); mag( (I - Foam::sqr(n.internalField())) & traction.internalField() );
@ -424,7 +424,7 @@ nCoupledFacesToBreak = 0;
} }
faceToBreakTraction *= scaleFactor; faceToBreakTraction *= scaleFactor;
topoChange = true; topoChange = true;
} }

View file

@ -23,7 +23,7 @@ The included solvers feature the following capabilities:
arbitrary crack propagation arbitrary crack propagation
custom boundary conditions custom boundary conditions
Aitken's under-relaation for displacement field Aitken's under-relaation for displacement field
A number of people have contributed to the development of the solvers, A number of people have contributed to the development of the solvers,
mainly within Alojz Ivankovic's research group. The code has been mainly within Alojz Ivankovic's research group. The code has been
assembled and is maintained by Philip Cardiff (University College Dublin), assembled and is maintained by Philip Cardiff (University College Dublin),

View file

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

View file

@ -1095,7 +1095,7 @@ int main(int argc, char *argv[])
{ {
mesh.addZones(List<pointZone*>(0), fz, cz); mesh.addZones(List<pointZone*>(0), fz, cz);
} }
removeEmptyPatches(mesh); removeEmptyPatches(mesh);
mesh.write(); mesh.write();

View file

@ -51,23 +51,23 @@ void writePointsToVTK
{ {
xmlTag xmlRoot("VTKFile"); xmlTag xmlRoot("VTKFile");
xmlRoot.addAttribute("type", "PolyData"); xmlRoot.addAttribute("type", "PolyData");
xmlTag& xmlPolyData = xmlRoot.addChild("PolyData"); xmlTag& xmlPolyData = xmlRoot.addChild("PolyData");
xmlTag& xmlPiece = xmlPolyData.addChild("Piece"); xmlTag& xmlPiece = xmlPolyData.addChild("Piece");
xmlPiece.addAttribute("NumberOfPoints", points.size()); xmlPiece.addAttribute("NumberOfPoints", points.size());
xmlTag& xmlPoints = xmlPiece.addChild("Points"); xmlTag& xmlPoints = xmlPiece.addChild("Points");
xmlTag& xmlPointData = xmlPoints.addChild("DataArray"); xmlTag& xmlPointData = xmlPoints.addChild("DataArray");
xmlPointData.addAttribute("type", "Float32"); xmlPointData.addAttribute("type", "Float32");
xmlPointData.addAttribute("NumberOfComponents", 3); xmlPointData.addAttribute("NumberOfComponents", 3);
xmlPointData.addAttribute("format", "ascii"); xmlPointData.addAttribute("format", "ascii");
xmlPointData << points; xmlPointData << points;
OFstream os(fn); OFstream os(fn);
os << xmlRoot << endl; os << xmlRoot << endl;
Info << "Created " << fn << endl; Info << "Created " << fn << endl;
} }
@ -83,12 +83,12 @@ void writePointsToVTK
{ {
// Create subaddressed points // Create subaddressed points
pointField newPoints(addr.size()); pointField newPoints(addr.size());
forAll(addr, i) forAll(addr, i)
{ {
newPoints[i] = points[addr[i]]; newPoints[i] = points[addr[i]];
} }
writePointsToVTK writePointsToVTK
( (
fn, fn,
@ -108,23 +108,23 @@ void writeEdgesToVTK
) )
{ {
labelList connectivity(edges.size()); labelList connectivity(edges.size());
forAll(edges, edgeI) forAll(edges, edgeI)
{ {
connectivity[edgeI] = 2*(edgeI+1); connectivity[edgeI] = 2*(edgeI+1);
} }
xmlTag xmlRoot("VTKFile"); xmlTag xmlRoot("VTKFile");
xmlRoot.addAttribute("type", "PolyData"); xmlRoot.addAttribute("type", "PolyData");
xmlTag& xmlPolyData = xmlRoot.addChild("PolyData"); xmlTag& xmlPolyData = xmlRoot.addChild("PolyData");
xmlTag& xmlPiece = xmlPolyData.addChild("Piece"); xmlTag& xmlPiece = xmlPolyData.addChild("Piece");
xmlPiece.addAttribute("NumberOfPoints", points.size()); xmlPiece.addAttribute("NumberOfPoints", points.size());
xmlPiece.addAttribute("NumberOfLines", edges.size()); xmlPiece.addAttribute("NumberOfLines", edges.size());
xmlTag& xmlPoints = xmlPiece.addChild("Points"); xmlTag& xmlPoints = xmlPiece.addChild("Points");
xmlTag& xmlPointData = xmlPoints.addChild("DataArray"); xmlTag& xmlPointData = xmlPoints.addChild("DataArray");
xmlPointData.addAttribute("type", "Float32"); xmlPointData.addAttribute("type", "Float32");
xmlPointData.addAttribute("NumberOfComponents", 3); xmlPointData.addAttribute("NumberOfComponents", 3);
@ -144,7 +144,7 @@ void writeEdgesToVTK
xmlConnectData.addAttribute("Name", "offsets"); xmlConnectData.addAttribute("Name", "offsets");
xmlConnectData.addAttribute("format", "ascii"); xmlConnectData.addAttribute("format", "ascii");
xmlConnectData << connectivity; xmlConnectData << connectivity;
OFstream os(fn); OFstream os(fn);
os << xmlRoot << endl; os << xmlRoot << endl;
@ -165,28 +165,28 @@ void writeEdgesToVTK
DynamicList<point> newPoints; DynamicList<point> newPoints;
labelList newPointAddr(points.size(), -1); labelList newPointAddr(points.size(), -1);
LongList<edge> newEdges(addr.size()); LongList<edge> newEdges(addr.size());
forAll(addr, addrI) forAll(addr, addrI)
{ {
label edgeI = addr[addrI]; label edgeI = addr[addrI];
const edge& curEdge = edges[edgeI]; const edge& curEdge = edges[edgeI];
edge& newEdge = newEdges[addrI]; edge& newEdge = newEdges[addrI];
forAll(curEdge, i) forAll(curEdge, i)
{ {
label pointId = curEdge[i]; label pointId = curEdge[i];
if (newPointAddr[pointId] == -1) if (newPointAddr[pointId] == -1)
{ {
newPoints.append(points[pointId]); newPoints.append(points[pointId]);
newPointAddr[pointId] = newPoints.size()-1; newPointAddr[pointId] = newPoints.size()-1;
} }
newEdge[i] = newPointAddr[pointId]; newEdge[i] = newPointAddr[pointId];
} }
} }
writeEdgesToVTK writeEdgesToVTK
( (
fn, fn,
@ -207,30 +207,30 @@ void writeFacetsToVTK
) )
{ {
labelList connectivity(facets.size()); labelList connectivity(facets.size());
forAll(facets, faceI) forAll(facets, faceI)
{ {
connectivity[faceI] = 3*(faceI+1); connectivity[faceI] = 3*(faceI+1);
} }
labelList regionData(facets.size()); labelList regionData(facets.size());
forAll(facets, faceI) forAll(facets, faceI)
{ {
regionData[faceI] = facets[faceI].region(); regionData[faceI] = facets[faceI].region();
} }
xmlTag xmlRoot("VTKFile"); xmlTag xmlRoot("VTKFile");
xmlRoot.addAttribute("type", "PolyData"); xmlRoot.addAttribute("type", "PolyData");
xmlTag& xmlPolyData = xmlRoot.addChild("PolyData"); xmlTag& xmlPolyData = xmlRoot.addChild("PolyData");
xmlTag& xmlPiece = xmlPolyData.addChild("Piece"); xmlTag& xmlPiece = xmlPolyData.addChild("Piece");
xmlPiece.addAttribute("NumberOfPoints", points.size()); xmlPiece.addAttribute("NumberOfPoints", points.size());
xmlPiece.addAttribute("NumberOfPolys", facets.size()); xmlPiece.addAttribute("NumberOfPolys", facets.size());
xmlTag& xmlPoints = xmlPiece.addChild("Points"); xmlTag& xmlPoints = xmlPiece.addChild("Points");
xmlTag& xmlPointData = xmlPoints.addChild("DataArray"); xmlTag& xmlPointData = xmlPoints.addChild("DataArray");
xmlPointData.addAttribute("type", "Float32"); xmlPointData.addAttribute("type", "Float32");
xmlPointData.addAttribute("NumberOfComponents", 3); xmlPointData.addAttribute("NumberOfComponents", 3);
@ -250,18 +250,18 @@ void writeFacetsToVTK
xmlConnectData.addAttribute("Name", "offsets"); xmlConnectData.addAttribute("Name", "offsets");
xmlConnectData.addAttribute("format", "ascii"); xmlConnectData.addAttribute("format", "ascii");
xmlConnectData << connectivity; xmlConnectData << connectivity;
xmlTag& xmlCellData = xmlPiece.addChild("CellData"); xmlTag& xmlCellData = xmlPiece.addChild("CellData");
xmlTag& xmlCellDataArray = xmlCellData.addChild("DataArray"); xmlTag& xmlCellDataArray = xmlCellData.addChild("DataArray");
xmlCellDataArray.addAttribute("type", "Int32"); xmlCellDataArray.addAttribute("type", "Int32");
xmlCellDataArray.addAttribute("Name", "region"); xmlCellDataArray.addAttribute("Name", "region");
xmlCellDataArray.addAttribute("format", "ascii"); xmlCellDataArray.addAttribute("format", "ascii");
xmlCellDataArray << regionData; xmlCellDataArray << regionData;
OFstream os(fn); OFstream os(fn);
os << xmlRoot << endl; os << xmlRoot << endl;
Info << "Created " << fn << endl; Info << "Created " << fn << endl;
} }
@ -276,33 +276,33 @@ void writeFacetsToVTK
const LongList<labelledTri>& facets, const LongList<labelledTri>& facets,
const unallocLabelList& addr const unallocLabelList& addr
) )
{ {
// Remove unused points and create subaddressed facets // Remove unused points and create subaddressed facets
DynamicList<point> newPoints; DynamicList<point> newPoints;
labelList newPointAddr(points.size(), -1); labelList newPointAddr(points.size(), -1);
LongList<labelledTri> newFacets(addr.size()); LongList<labelledTri> newFacets(addr.size());
forAll(addr, addrI) forAll(addr, addrI)
{ {
label faceI = addr[addrI]; label faceI = addr[addrI];
const labelledTri& facet = facets[faceI]; const labelledTri& facet = facets[faceI];
const FixedList<label, 3>& pointIds = facet; const FixedList<label, 3>& pointIds = facet;
FixedList<label, 3> newPointIds; FixedList<label, 3> newPointIds;
forAll(pointIds, i) forAll(pointIds, i)
{ {
label pointId = pointIds[i]; label pointId = pointIds[i];
if (newPointAddr[pointId] == -1) if (newPointAddr[pointId] == -1)
{ {
newPoints.append(points[pointId]); newPoints.append(points[pointId]);
newPointAddr[pointId] = newPoints.size()-1; newPointAddr[pointId] = newPoints.size()-1;
} }
newPointIds[i] = newPointAddr[pointId]; newPointIds[i] = newPointAddr[pointId];
} }
newFacets[addrI] = labelledTri newFacets[addrI] = labelledTri
( (
newPointIds[0], newPointIds[0],
@ -311,7 +311,7 @@ void writeFacetsToVTK
facet.region() facet.region()
); );
} }
writeFacetsToVTK writeFacetsToVTK
( (
fn, fn,
@ -334,36 +334,36 @@ int main(int argc, char *argv[])
// Process commandline arguments // Process commandline arguments
fileName inFileName(args.args()[1]); fileName inFileName(args.args()[1]);
fileName outPrefix(args.args()[2]); fileName outPrefix(args.args()[2]);
// Read original surface // Read original surface
triSurf origSurf(inFileName); triSurf origSurf(inFileName);
const pointField& points = origSurf.points(); const pointField& points = origSurf.points();
const LongList<labelledTri>& facets = origSurf.facets(); const LongList<labelledTri>& facets = origSurf.facets();
const LongList<edge>& edges = origSurf.featureEdges(); const LongList<edge>& edges = origSurf.featureEdges();
const geometricSurfacePatchList& patches = origSurf.patches(); const geometricSurfacePatchList& patches = origSurf.patches();
label index = 0; label index = 0;
// Create file structure for multiblock dataset // Create file structure for multiblock dataset
mkDir(outPrefix); mkDir(outPrefix);
mkDir(outPrefix + "/patches"); mkDir(outPrefix + "/patches");
mkDir(outPrefix + "/pointSubsets"); mkDir(outPrefix + "/pointSubsets");
mkDir(outPrefix + "/edgeSubsets"); mkDir(outPrefix + "/edgeSubsets");
mkDir(outPrefix + "/faceSubsets"); mkDir(outPrefix + "/faceSubsets");
// Create VTK multiblock dataset file // Create VTK multiblock dataset file
xmlTag xmlRoot("VTKFile"); xmlTag xmlRoot("VTKFile");
xmlRoot.addAttribute("type", "vtkMultiBlockDataSet"); xmlRoot.addAttribute("type", "vtkMultiBlockDataSet");
xmlRoot.addAttribute("version", "1.0"); xmlRoot.addAttribute("version", "1.0");
xmlRoot.addAttribute("byte_order", "LittleEndian"); xmlRoot.addAttribute("byte_order", "LittleEndian");
xmlTag& xmlDataSet = xmlRoot.addChild("vtkMultiBlockDataSet"); xmlTag& xmlDataSet = xmlRoot.addChild("vtkMultiBlockDataSet");
// Write faces and feature edges // Write faces and feature edges
{ {
fileName fn = outPrefix / "facets.vtp"; fileName fn = outPrefix / "facets.vtp";
writeFacetsToVTK writeFacetsToVTK
( (
outPrefix / "facets.vtp", outPrefix / "facets.vtp",
@ -371,16 +371,16 @@ int main(int argc, char *argv[])
points, points,
facets facets
); );
xmlTag& tag = xmlDataSet.addChild("DataSet"); xmlTag& tag = xmlDataSet.addChild("DataSet");
tag.addAttribute("index", Foam::name(index++)); tag.addAttribute("index", Foam::name(index++));
tag.addAttribute("name", "facets"); tag.addAttribute("name", "facets");
tag.addAttribute("file", fn); tag.addAttribute("file", fn);
} }
{ {
fileName fn = outPrefix / "featureEdges.vtp"; fileName fn = outPrefix / "featureEdges.vtp";
writeEdgesToVTK writeEdgesToVTK
( (
outPrefix / "featureEdges.vtp", outPrefix / "featureEdges.vtp",
@ -388,33 +388,33 @@ int main(int argc, char *argv[])
points, points,
edges edges
); );
xmlTag& tag = xmlDataSet.addChild("DataSet"); xmlTag& tag = xmlDataSet.addChild("DataSet");
tag.addAttribute("index", Foam::name(index++)); tag.addAttribute("index", Foam::name(index++));
tag.addAttribute("name", "featureEdges"); tag.addAttribute("name", "featureEdges");
tag.addAttribute("file", fn); tag.addAttribute("file", fn);
} }
// Write patches // Write patches
// Create patch addressing // Create patch addressing
List<DynamicList<label> > patchAddr(patches.size()); List<DynamicList<label> > patchAddr(patches.size());
forAll(facets, faceI) forAll(facets, faceI)
{ {
patchAddr[facets[faceI].region()].append(faceI); patchAddr[facets[faceI].region()].append(faceI);
} }
{ {
xmlTag& xmlBlock = xmlDataSet.addChild("Block"); xmlTag& xmlBlock = xmlDataSet.addChild("Block");
xmlBlock.addAttribute("index", Foam::name(index++)); xmlBlock.addAttribute("index", Foam::name(index++));
xmlBlock.addAttribute("name", "patches"); xmlBlock.addAttribute("name", "patches");
forAll(patches, patchI) forAll(patches, patchI)
{ {
word patchName = patches[patchI].name(); word patchName = patches[patchI].name();
fileName fn = outPrefix / "patches" / patchName + ".vtp"; fileName fn = outPrefix / "patches" / patchName + ".vtp";
writeFacetsToVTK writeFacetsToVTK
( (
fn, fn,
@ -423,32 +423,32 @@ int main(int argc, char *argv[])
facets, facets,
patchAddr[patchI] patchAddr[patchI]
); );
xmlTag& tag = xmlBlock.addChild("DataSet"); xmlTag& tag = xmlBlock.addChild("DataSet");
tag.addAttribute("index", Foam::name(patchI)); tag.addAttribute("index", Foam::name(patchI));
tag.addAttribute("name", patchName); tag.addAttribute("name", patchName);
tag.addAttribute("file", fn); tag.addAttribute("file", fn);
} }
} }
// Write point subsets // Write point subsets
{ {
xmlTag& xmlBlock = xmlDataSet.addChild("Block"); xmlTag& xmlBlock = xmlDataSet.addChild("Block");
xmlBlock.addAttribute("index", Foam::name(index++)); xmlBlock.addAttribute("index", Foam::name(index++));
xmlBlock.addAttribute("name", "pointSubsets"); xmlBlock.addAttribute("name", "pointSubsets");
DynList<label> subsetIndices; DynList<label> subsetIndices;
labelList subsetAddr; labelList subsetAddr;
origSurf.pointSubsetIndices(subsetIndices); origSurf.pointSubsetIndices(subsetIndices);
forAll(subsetIndices, id) forAll(subsetIndices, id)
{ {
word subsetName = origSurf.pointSubsetName(id); word subsetName = origSurf.pointSubsetName(id);
origSurf.pointsInSubset(id, subsetAddr); origSurf.pointsInSubset(id, subsetAddr);
fileName fn = outPrefix / "pointSubsets" / subsetName + ".vtp"; fileName fn = outPrefix / "pointSubsets" / subsetName + ".vtp";
writePointsToVTK writePointsToVTK
( (
fn, fn,
@ -456,32 +456,32 @@ int main(int argc, char *argv[])
points, points,
subsetAddr subsetAddr
); );
xmlTag& tag = xmlBlock.addChild("DataSet"); xmlTag& tag = xmlBlock.addChild("DataSet");
tag.addAttribute("index", Foam::name(id)); tag.addAttribute("index", Foam::name(id));
tag.addAttribute("name", subsetName); tag.addAttribute("name", subsetName);
tag.addAttribute("file", fn); tag.addAttribute("file", fn);
} }
} }
// Write edge subsets // Write edge subsets
{ {
xmlTag& xmlBlock = xmlDataSet.addChild("Block"); xmlTag& xmlBlock = xmlDataSet.addChild("Block");
xmlBlock.addAttribute("index", Foam::name(index++)); xmlBlock.addAttribute("index", Foam::name(index++));
xmlBlock.addAttribute("name", "edgeSubsets"); xmlBlock.addAttribute("name", "edgeSubsets");
DynList<label> subsetIndices; DynList<label> subsetIndices;
labelList subsetAddr; labelList subsetAddr;
origSurf.edgeSubsetIndices(subsetIndices); origSurf.edgeSubsetIndices(subsetIndices);
forAll(subsetIndices, id) forAll(subsetIndices, id)
{ {
word subsetName = origSurf.edgeSubsetName(id); word subsetName = origSurf.edgeSubsetName(id);
origSurf.edgesInSubset(id, subsetAddr); origSurf.edgesInSubset(id, subsetAddr);
fileName fn = outPrefix / "edgeSubsets" / subsetName + ".vtp"; fileName fn = outPrefix / "edgeSubsets" / subsetName + ".vtp";
writeEdgesToVTK writeEdgesToVTK
( (
fn, fn,
@ -490,32 +490,32 @@ int main(int argc, char *argv[])
edges, edges,
subsetAddr subsetAddr
); );
xmlTag& tag = xmlBlock.addChild("DataSet"); xmlTag& tag = xmlBlock.addChild("DataSet");
tag.addAttribute("index", Foam::name(id)); tag.addAttribute("index", Foam::name(id));
tag.addAttribute("name", subsetName); tag.addAttribute("name", subsetName);
tag.addAttribute("file", fn); tag.addAttribute("file", fn);
} }
} }
// Write facet subsets // Write facet subsets
{ {
xmlTag& xmlBlock = xmlDataSet.addChild("Block"); xmlTag& xmlBlock = xmlDataSet.addChild("Block");
xmlBlock.addAttribute("index", Foam::name(index++)); xmlBlock.addAttribute("index", Foam::name(index++));
xmlBlock.addAttribute("name", "faceSubsets"); xmlBlock.addAttribute("name", "faceSubsets");
DynList<label> subsetIndices; DynList<label> subsetIndices;
labelList subsetAddr; labelList subsetAddr;
origSurf.facetSubsetIndices(subsetIndices); origSurf.facetSubsetIndices(subsetIndices);
forAll(subsetIndices, id) forAll(subsetIndices, id)
{ {
word subsetName = origSurf.facetSubsetName(id); word subsetName = origSurf.facetSubsetName(id);
origSurf.facetsInSubset(id, subsetAddr); origSurf.facetsInSubset(id, subsetAddr);
fileName fn = outPrefix / "faceSubsets" / subsetName + ".vtp"; fileName fn = outPrefix / "faceSubsets" / subsetName + ".vtp";
writeFacetsToVTK writeFacetsToVTK
( (
fn, fn,
@ -524,21 +524,21 @@ int main(int argc, char *argv[])
facets, facets,
subsetAddr subsetAddr
); );
xmlTag& tag = xmlBlock.addChild("DataSet"); xmlTag& tag = xmlBlock.addChild("DataSet");
tag.addAttribute("index", Foam::name(id)); tag.addAttribute("index", Foam::name(id));
tag.addAttribute("name", subsetName); tag.addAttribute("name", subsetName);
tag.addAttribute("file", fn); tag.addAttribute("file", fn);
} }
} }
OFstream os(outPrefix + ".vtm"); OFstream os(outPrefix + ".vtm");
os << xmlRoot << endl; os << xmlRoot << endl;
Info << "Created " << outPrefix + ".vtm" << endl; Info << "Created " << outPrefix + ".vtm" << endl;
Info << "End\n" << endl; Info << "End\n" << endl;
return 0; return 0;
} }

View file

@ -54,16 +54,16 @@ class xmlTag
public OStringStream public OStringStream
{ {
// Private data // Private data
//- Tag name //- Tag name
word name_; word name_;
//- Attributes //- Attributes
HashTable<string> attributes_; HashTable<string> attributes_;
//- Child tags //- Child tags
DynamicList<xmlTag> children_; DynamicList<xmlTag> children_;
public: public:
// Constructors // Constructors
@ -76,7 +76,7 @@ public:
attributes_(), attributes_(),
children_() children_()
{} {}
//- Construct given tag name //- Construct given tag name
xmlTag(const word& name) xmlTag(const word& name)
: :
@ -101,7 +101,7 @@ public:
// Member Functions // Member Functions
//- Add an attribute //- Add an attribute
template<class T> template<class T>
void addAttribute(const keyType& key, const T& value) void addAttribute(const keyType& key, const T& value)
@ -110,13 +110,13 @@ public:
os << value; os << value;
attributes_.insert(key, os.str()); attributes_.insert(key, os.str());
}; };
//- Add a fileName attribute //- Add a fileName attribute
void addAttribute(const keyType& key, const fileName& value) void addAttribute(const keyType& key, const fileName& value)
{ {
attributes_.insert(key, value); attributes_.insert(key, value);
}; };
//- Add a string attribute //- Add a string attribute
void addAttribute(const keyType& key, const string& value) void addAttribute(const keyType& key, const string& value)
{ {
@ -128,15 +128,15 @@ public:
{ {
attributes_.insert(key, value); attributes_.insert(key, value);
}; };
//- Add a child //- Add a child
xmlTag& addChild(const xmlTag& tag) xmlTag& addChild(const xmlTag& tag)
{ {
children_.append(tag); children_.append(tag);
return children_[children_.size()-1]; return children_[children_.size()-1];
}; };
//- Create and add a new child //- Create and add a new child
xmlTag& addChild(const word& name) xmlTag& addChild(const word& name)
{ {
@ -149,26 +149,26 @@ public:
{ {
name_ = tag.name_; name_ = tag.name_;
attributes_ = tag.attributes_; attributes_ = tag.attributes_;
children_ = tag.children_; children_ = tag.children_;
OStringStream::rewind(); OStringStream::rewind();
Foam::operator<<(*this, tag.str().c_str()); Foam::operator<<(*this, tag.str().c_str());
}; };
// Friend IOstream Operators // Friend IOstream Operators
friend Ostream& operator<<(Ostream&, const xmlTag&); friend Ostream& operator<<(Ostream&, const xmlTag&);
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, int nCmpt>
friend xmlTag& operator<<(xmlTag&, const VectorSpace<Form, Cmpt, nCmpt>&); friend xmlTag& operator<<(xmlTag&, const VectorSpace<Form, Cmpt, nCmpt>&);
friend xmlTag& operator<<(xmlTag&, const labelledTri&); friend xmlTag& operator<<(xmlTag&, const labelledTri&);
template<class T, unsigned Size> template<class T, unsigned Size>
friend xmlTag& operator<<(xmlTag&, const FixedList<T, Size>&); friend xmlTag& operator<<(xmlTag&, const FixedList<T, Size>&);
template<class T> template<class T>
friend xmlTag& operator<<(xmlTag&, const LongList<T>&); friend xmlTag& operator<<(xmlTag&, const LongList<T>&);
template<class T> template<class T>
friend xmlTag& operator<<(xmlTag&, const UList<T>&); friend xmlTag& operator<<(xmlTag&, const UList<T>&);
}; };
@ -180,7 +180,7 @@ Ostream& operator<<(Ostream& os, const xmlTag& tag)
{ {
// Tag name // Tag name
os << indent << '<' << tag.name_; os << indent << '<' << tag.name_;
// Attributes and text // Attributes and text
for for
( (
@ -191,24 +191,24 @@ Ostream& operator<<(Ostream& os, const xmlTag& tag)
{ {
os << token::SPACE << iter.key() << '=' << iter(); os << token::SPACE << iter.key() << '=' << iter();
} }
if (tag.str().size() || tag.children_.size()) if (tag.str().size() || tag.children_.size())
{ {
os << '>' << nl; os << '>' << nl;
// Children // Children
os.incrIndent(); os.incrIndent();
forAll(tag.children_, i) forAll(tag.children_, i)
{ {
os << tag.children_[i]; os << tag.children_[i];
} }
os.decrIndent(); os.decrIndent();
// Tag text // Tag text
os << tag.str().c_str(); os << tag.str().c_str();
// Close tag // Close tag
os << indent << "</" << tag.name_ << '>' << endl; os << indent << "</" << tag.name_ << '>' << endl;
} }
@ -229,9 +229,9 @@ xmlTag& operator<<(xmlTag& tag, const UList<T>& data)
{ {
tag << data[i] << token::SPACE; tag << data[i] << token::SPACE;
} }
tag << nl; tag << nl;
return tag; return tag;
} }
@ -243,9 +243,9 @@ xmlTag& operator<<(xmlTag& tag, const LongList<T>& data)
{ {
tag << data[i] << token::SPACE; tag << data[i] << token::SPACE;
} }
tag << nl; tag << nl;
return tag; return tag;
} }
@ -258,9 +258,9 @@ xmlTag& operator<<(xmlTag& tag, const VectorSpace<Form, Cmpt, nCmpt>& data)
{ {
tag << data[i] << token::SPACE; tag << data[i] << token::SPACE;
} }
tag << nl; tag << nl;
return tag; return tag;
} }
@ -272,9 +272,9 @@ xmlTag& operator<<(xmlTag& tag, const FixedList<T, Size>& data)
{ {
tag << data[i] << token::SPACE; tag << data[i] << token::SPACE;
} }
tag << nl; tag << nl;
return tag; return tag;
} }
@ -282,10 +282,10 @@ xmlTag& operator<<(xmlTag& tag, const FixedList<T, Size>& data)
xmlTag& operator<<(xmlTag& tag, const labelledTri& data) xmlTag& operator<<(xmlTag& tag, const labelledTri& data)
{ {
const triFace& tFace = data; const triFace& tFace = data;
return tag << tFace; return tag << tFace;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View file

@ -39,27 +39,27 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
fileName inFileName; fileName inFileName;
Info << "Reading mesh from file " << endl; Info << "Reading mesh from file " << endl;
cin >> inFileName; cin >> inFileName;
IFstream file(inFileName); IFstream file(inFileName);
polyMeshGen pmg(runTime); polyMeshGen pmg(runTime);
polyMeshGenModifier meshModifier(pmg); polyMeshGenModifier meshModifier(pmg);
label counter; label counter;
//- read the number of vertices //- read the number of vertices
pointFieldPMG& points = meshModifier.pointsAccess(); pointFieldPMG& points = meshModifier.pointsAccess();
file >> counter; file >> counter;
//- read points from file //- read points from file
points.setSize(counter); points.setSize(counter);
forAll(points, pointI) forAll(points, pointI)
@ -68,79 +68,79 @@ int main(int argc, char *argv[])
file >> p.x(); file >> p.x();
file >> p.y(); file >> p.y();
file >> p.z(); file >> p.z();
points[pointI] = p; points[pointI] = p;
} }
//- read the number of faces //- read the number of faces
file >> counter; file >> counter;
faceListPMG& faces = meshModifier.facesAccess(); faceListPMG& faces = meshModifier.facesAccess();
//- read faces from file //- read faces from file
faces.setSize(counter); faces.setSize(counter);
forAll(faces, faceI) forAll(faces, faceI)
{ {
file >> counter; file >> counter;
face f; face f;
f.setSize(counter); f.setSize(counter);
forAll(f, pI) forAll(f, pI)
file >> f[pI]; file >> f[pI];
faces[faceI] = f.reverseFace(); faces[faceI] = f.reverseFace();
} }
//- read the number of cells //- read the number of cells
file >> counter; file >> counter;
//- read cells from file //- read cells from file
cellListPMG& cells = meshModifier.cellsAccess(); cellListPMG& cells = meshModifier.cellsAccess();
cells.setSize(counter); cells.setSize(counter);
forAll(cells, cellI) forAll(cells, cellI)
{ {
file >> counter; file >> counter;
cell& c = cells[cellI]; cell& c = cells[cellI];
c.setSize(counter); c.setSize(counter);
forAll(c, fI) forAll(c, fI)
file >> c[fI]; file >> c[fI];
} }
//- read selections //- read selections
file >> counter; file >> counter;
wordList patchNames; wordList patchNames;
Map<label> subsetToPatch; Map<label> subsetToPatch;
for(label setI=0;setI<counter;++setI) for(label setI=0;setI<counter;++setI)
{ {
word sName; word sName;
file >> sName; file >> sName;
label type; label type;
file >> type; file >> type;
label nEntries; label nEntries;
file >> nEntries; file >> nEntries;
switch( type ) switch( type )
{ {
case 3: case 3:
{ {
//- face selection //- face selection
const label id = pmg.addFaceSubset(sName); const label id = pmg.addFaceSubset(sName);
patchNames.setSize(patchNames.size()+1); patchNames.setSize(patchNames.size()+1);
patchNames[patchNames.size()-1] = sName; patchNames[patchNames.size()-1] = sName;
subsetToPatch.insert(id, patchNames.size()-1); subsetToPatch.insert(id, patchNames.size()-1);
Info << "Reading face selection " << sName << endl; Info << "Reading face selection " << sName << endl;
for(label i=0;i<nEntries;++i) for(label i=0;i<nEntries;++i)
{ {
label entryI; label entryI;
@ -152,7 +152,7 @@ int main(int argc, char *argv[])
{ {
//- cell selection //- cell selection
const label id = pmg.addCellSubset(sName); const label id = pmg.addCellSubset(sName);
for(label i=0;i<nEntries;++i) for(label i=0;i<nEntries;++i)
{ {
label entryI; label entryI;
@ -164,7 +164,7 @@ int main(int argc, char *argv[])
{ {
//- node selection //- node selection
const label id = pmg.addPointSubset(sName); const label id = pmg.addPointSubset(sName);
for(label i=0;i<nEntries;++i) for(label i=0;i<nEntries;++i)
{ {
label entryI; label entryI;
@ -174,31 +174,31 @@ int main(int argc, char *argv[])
} break; } break;
}; };
} }
//- create patches from face selections //- create patches from face selections
VRWGraph boundaryFaces; VRWGraph boundaryFaces;
labelLongList boundaryOwner; labelLongList boundaryOwner;
labelLongList boundaryPatches; labelLongList boundaryPatches;
const labelList& owner = pmg.owner(); const labelList& owner = pmg.owner();
DynList<label> faceSubsets; DynList<label> faceSubsets;
pmg.faceSubsetIndices(faceSubsets); pmg.faceSubsetIndices(faceSubsets);
forAll(faceSubsets, setI) forAll(faceSubsets, setI)
{ {
labelLongList setFaces; labelLongList setFaces;
pmg.facesInSubset(faceSubsets[setI], setFaces); pmg.facesInSubset(faceSubsets[setI], setFaces);
forAll(setFaces, i) forAll(setFaces, i)
{ {
boundaryFaces.appendList(faces[setFaces[i]]); boundaryFaces.appendList(faces[setFaces[i]]);
boundaryOwner.append(owner[setFaces[i]]); boundaryOwner.append(owner[setFaces[i]]);
boundaryPatches.append(subsetToPatch[faceSubsets[setI]]); boundaryPatches.append(subsetToPatch[faceSubsets[setI]]);
} }
pmg.removeFaceSubset(faceSubsets[setI]); pmg.removeFaceSubset(faceSubsets[setI]);
} }
meshModifier.reorderBoundaryFaces(); meshModifier.reorderBoundaryFaces();
meshModifier.replaceBoundary meshModifier.replaceBoundary
( (
@ -207,9 +207,9 @@ int main(int argc, char *argv[])
boundaryOwner, boundaryOwner,
boundaryPatches boundaryPatches
); );
pmg.write(); pmg.write();
Info << "End\n" << endl; Info << "End\n" << endl;
return 0; return 0;
} }

View file

@ -51,10 +51,10 @@ void getPatchIds
) )
{ {
const geometricSurfacePatchList& origPatches = origSurf.patches(); const geometricSurfacePatchList& origPatches = origSurf.patches();
// Create patch name map // Create patch name map
HashSet<word> patchNameHash(patchNames); HashSet<word> patchNameHash(patchNames);
// Find selected patches // Find selected patches
label nFound = 0; label nFound = 0;
forAll(origPatches, patchI) forAll(origPatches, patchI)
@ -65,7 +65,7 @@ void getPatchIds
nFound++; nFound++;
} }
} }
if (nFound != patchNames.size()) if (nFound != patchNames.size())
{ {
WarningIn("getPatchIds") WarningIn("getPatchIds")
@ -83,17 +83,17 @@ void copyFaceSubsets
{ {
DynList<label> subsetIds; DynList<label> subsetIds;
origSurf.facetSubsetIndices(subsetIds); origSurf.facetSubsetIndices(subsetIds);
forAll(subsetIds, subsetI) forAll(subsetIds, subsetI)
{ {
label newSubsetId = newSurf.addFacetSubset label newSubsetId = newSurf.addFacetSubset
( (
origSurf.facetSubsetName(subsetI) origSurf.facetSubsetName(subsetI)
); );
labelList origFaces; labelList origFaces;
origSurf.facetsInSubset(subsetI, origFaces); origSurf.facetsInSubset(subsetI, origFaces);
forAll(origFaces, faceI) forAll(origFaces, faceI)
{ {
newSurf.addFacetToSubset newSurf.addFacetToSubset
@ -115,17 +115,17 @@ void copyEdgeSubsets
{ {
DynList<label> subsetIds; DynList<label> subsetIds;
origSurf.edgeSubsetIndices(subsetIds); origSurf.edgeSubsetIndices(subsetIds);
forAll(subsetIds, subsetI) forAll(subsetIds, subsetI)
{ {
label newSubsetId = newSurf.addEdgeSubset label newSubsetId = newSurf.addEdgeSubset
( (
origSurf.edgeSubsetName(subsetI) origSurf.edgeSubsetName(subsetI)
); );
labelList origEdges; labelList origEdges;
origSurf.edgesInSubset(subsetI, origEdges); origSurf.edgesInSubset(subsetI, origEdges);
forAll(origEdges, faceI) forAll(origEdges, faceI)
{ {
newSurf.addEdgeToSubset newSurf.addEdgeToSubset
@ -147,17 +147,17 @@ void copyPointSubsets
{ {
DynList<label> subsetIds; DynList<label> subsetIds;
origSurf.pointSubsetIndices(subsetIds); origSurf.pointSubsetIndices(subsetIds);
forAll(subsetIds, subsetI) forAll(subsetIds, subsetI)
{ {
label newSubsetId = newSurf.addPointSubset label newSubsetId = newSurf.addPointSubset
( (
origSurf.pointSubsetName(subsetI) origSurf.pointSubsetName(subsetI)
); );
labelList origPoints; labelList origPoints;
origSurf.pointsInSubset(subsetI, origPoints); origSurf.pointsInSubset(subsetI, origPoints);
forAll(origPoints, faceI) forAll(origPoints, faceI)
{ {
newSurf.addPointToSubset newSurf.addPointToSubset
@ -181,20 +181,20 @@ autoPtr<triSurf> mergeSurfacePatches
{ {
const geometricSurfacePatchList& origPatches = origSurf.patches(); const geometricSurfacePatchList& origPatches = origSurf.patches();
const LongList<labelledTri>& origFacets = origSurf.facets(); const LongList<labelledTri>& origFacets = origSurf.facets();
label newPatchId = origPatches.size(); label newPatchId = origPatches.size();
// Determine new patch type // Determine new patch type
word newPatchType = origPatches[patchIds[0]].geometricType(); word newPatchType = origPatches[patchIds[0]].geometricType();
// Create patch addressing // Create patch addressing
List<DynamicList<label> > patchAddr(origPatches.size()+1); List<DynamicList<label> > patchAddr(origPatches.size()+1);
forAll(origFacets, faceI) forAll(origFacets, faceI)
{ {
patchAddr[origFacets[faceI].region()].append(faceI); patchAddr[origFacets[faceI].region()].append(faceI);
} }
// Move selected patches to new patch // Move selected patches to new patch
forAll(patchIds, patchI) forAll(patchIds, patchI)
{ {
@ -205,35 +205,35 @@ autoPtr<triSurf> mergeSurfacePatches
// Create new facets list // Create new facets list
LongList<labelledTri> newFacets(origFacets.size()); LongList<labelledTri> newFacets(origFacets.size());
labelList newFaceAddr(origFacets.size(), -1); labelList newFaceAddr(origFacets.size(), -1);
label patchCount = 0; label patchCount = 0;
label faceI = 0; label faceI = 0;
forAll(patchAddr, patchI) forAll(patchAddr, patchI)
{ {
const unallocLabelList& addr = patchAddr[patchI]; const unallocLabelList& addr = patchAddr[patchI];
if(addr.size()) if(addr.size())
{ {
forAll(addr, i) forAll(addr, i)
{ {
newFacets[faceI] = origFacets[addr[i]]; newFacets[faceI] = origFacets[addr[i]];
newFacets[faceI].region() = patchCount; newFacets[faceI].region() = patchCount;
newFaceAddr[addr[i]] = faceI; newFaceAddr[addr[i]] = faceI;
faceI++; faceI++;
} }
} }
if(addr.size() || keepPatches) if(addr.size() || keepPatches)
{ {
patchCount++; patchCount++;
} }
} }
// Create new patch list // Create new patch list
geometricSurfacePatchList newPatches(patchCount); geometricSurfacePatchList newPatches(patchCount);
patchCount = 0; patchCount = 0;
forAll(origPatches, patchI) forAll(origPatches, patchI)
{ {
@ -243,13 +243,13 @@ autoPtr<triSurf> mergeSurfacePatches
newPatches[patchCount] = origPatches[patchI]; newPatches[patchCount] = origPatches[patchI];
newPatches[patchCount].index() = patchCount; newPatches[patchCount].index() = patchCount;
} }
if(patchAddr[patchI].size() || keepPatches) if(patchAddr[patchI].size() || keepPatches)
{ {
patchCount++; patchCount++;
} }
} }
// Add new patch if it contains faces // Add new patch if it contains faces
if(patchAddr[patchAddr.size()-1].size()) if(patchAddr[patchAddr.size()-1].size())
{ {
@ -264,7 +264,7 @@ autoPtr<triSurf> mergeSurfacePatches
{ {
patchCount++; patchCount++;
} }
// Create new surface // Create new surface
autoPtr<triSurf> newSurf autoPtr<triSurf> newSurf
( (
@ -276,17 +276,17 @@ autoPtr<triSurf> mergeSurfacePatches
origSurf.points() origSurf.points()
) )
); );
// Transfer face subsets // Transfer face subsets
copyFaceSubsets(origSurf, newSurf()); copyFaceSubsets(origSurf, newSurf());
newSurf->updateFacetsSubsets(newFaceAddr); newSurf->updateFacetsSubsets(newFaceAddr);
// Transfer feature edge subsets // Transfer feature edge subsets
copyEdgeSubsets(origSurf, newSurf()); copyEdgeSubsets(origSurf, newSurf());
// Transfer point subsets // Transfer point subsets
copyPointSubsets(origSurf, newSurf()); copyPointSubsets(origSurf, newSurf());
// Done // Done
return newSurf; return newSurf;
} }
@ -309,18 +309,18 @@ int main(int argc, char *argv[])
// Process commandline arguments // Process commandline arguments
fileName inFileName(args.args()[1]); fileName inFileName(args.args()[1]);
word newPatchName(args.args()[2]); word newPatchName(args.args()[2]);
fileName outFileName(inFileName); fileName outFileName(inFileName);
if( args.options().found("output") ) if( args.options().found("output") )
{ {
outFileName = args.options()["output"]; outFileName = args.options()["output"];
} }
bool keepPatches = false; bool keepPatches = false;
if( args.options().found("keep") ) if( args.options().found("keep") )
{ {
keepPatches = true; keepPatches = true;
@ -328,10 +328,10 @@ int main(int argc, char *argv[])
// Read original surface // Read original surface
triSurf origSurf(inFileName); triSurf origSurf(inFileName);
// Get patch ids // Get patch ids
DynamicList<label> patchIds; DynamicList<label> patchIds;
if (args.options().found("patchNames")) if (args.options().found("patchNames"))
{ {
if (args.options().found("patchIds")) if (args.options().found("patchIds"))
@ -339,10 +339,10 @@ int main(int argc, char *argv[])
FatalError() << "Cannot specify both patch names and ids" FatalError() << "Cannot specify both patch names and ids"
<< Foam::abort(FatalError); << Foam::abort(FatalError);
} }
IStringStream is(args.options()["patchNames"]); IStringStream is(args.options()["patchNames"]);
wordList patchNames(is); wordList patchNames(is);
getPatchIds getPatchIds
( (
origSurf, origSurf,
@ -353,32 +353,32 @@ int main(int argc, char *argv[])
if (args.options().found("patchIds")) if (args.options().found("patchIds"))
{ {
IStringStream is(args.options()["patchIds"]); IStringStream is(args.options()["patchIds"]);
patchIds = labelList(is); patchIds = labelList(is);
} }
if (args.options().found("patchIds")) if (args.options().found("patchIds"))
{ {
IStringStream is(args.options()["patchIds"]); IStringStream is(args.options()["patchIds"]);
patchIds.append(labelList(is)); patchIds.append(labelList(is));
} }
if (args.options().found("patchIdRange")) if (args.options().found("patchIdRange"))
{ {
IStringStream is(args.options()["patchIdRange"]); IStringStream is(args.options()["patchIdRange"]);
Pair<label> idRange(is); Pair<label> idRange(is);
for(label id = idRange.first(); id <= idRange.second(); id++) for(label id = idRange.first(); id <= idRange.second(); id++)
{ {
patchIds.append(id); patchIds.append(id);
} }
} }
if (!patchIds.size()) if (!patchIds.size())
{ {
FatalError() << "No patches specified" FatalError() << "No patches specified"
<< Foam::abort(FatalError); << Foam::abort(FatalError);
} }
// Merge patches // Merge patches
autoPtr<triSurf> newSurf = mergeSurfacePatches autoPtr<triSurf> newSurf = mergeSurfacePatches
( (
@ -387,16 +387,16 @@ int main(int argc, char *argv[])
newPatchName, newPatchName,
keepPatches keepPatches
); );
// Write new surface mesh // Write new surface mesh
newSurf->writeSurface(outFileName); newSurf->writeSurface(outFileName);
Info << "Original surface patches: " << origSurf.patches().size() << endl; Info << "Original surface patches: " << origSurf.patches().size() << endl;
Info << "Final surface patches: " << newSurf->patches().size() << endl; Info << "Final surface patches: " << newSurf->patches().size() << endl;
Info << "Surface written to " << outFileName << endl; Info << "Surface written to " << outFileName << endl;
Info << "End\n" << endl; Info << "End\n" << endl;
return 0; return 0;
} }

View file

@ -43,15 +43,15 @@ int main(int argc, char *argv[])
polyMeshGen pmg(runTime); polyMeshGen pmg(runTime);
pmg.read(); pmg.read();
if( Pstream::parRun() ) if( Pstream::parRun() )
{ {
polyMeshGenModifier(pmg).addBufferCells(); polyMeshGenModifier(pmg).addBufferCells();
createFIRESelections(pmg); createFIRESelections(pmg);
} }
writeMeshFPMA(pmg, "convertedMesh"); writeMeshFPMA(pmg, "convertedMesh");
Info << "End\n" << endl; Info << "End\n" << endl;
return 0; return 0;
} }

View file

@ -24,53 +24,53 @@ def extractFeatureEdges(body, minFeatureAngle = 5):
import GEOM import GEOM
from salome.geom import geomBuilder from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy) geompy = geomBuilder.New(salome.myStudy)
# Check the body type # Check the body type
if not (body.GetShapeType() in [GEOM.SHELL, GEOM.SOLID, GEOM.FACE, GEOM.COMPOUND]): if not (body.GetShapeType() in [GEOM.SHELL, GEOM.SOLID, GEOM.FACE, GEOM.COMPOUND]):
raise RuntimeError('Supplied object is not a solid, shell or face.') raise RuntimeError('Supplied object is not a solid, shell or face.')
print 'Extracting edges of %s with feature angle > %g.' % (body.GetName(), minFeatureAngle) print 'Extracting edges of %s with feature angle > %g.' % (body.GetName(), minFeatureAngle)
# Extract basic info # Extract basic info
faces = geompy.SubShapeAll(body, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAll(body, geompy.ShapeType["FACE"])
curves = geompy.SubShapeAll(body, geompy.ShapeType["EDGE"]) curves = geompy.SubShapeAll(body, geompy.ShapeType["EDGE"])
points = geompy.SubShapeAll(body, geompy.ShapeType["VERTEX"]) points = geompy.SubShapeAll(body, geompy.ShapeType["VERTEX"])
faceIds = geompy.GetSubShapesIDs(body, faces) faceIds = geompy.GetSubShapesIDs(body, faces)
curveIds = geompy.GetSubShapesIDs(body, curves) curveIds = geompy.GetSubShapesIDs(body, curves)
nodeIds = geompy.GetSubShapesIDs(body, points) nodeIds = geompy.GetSubShapesIDs(body, points)
maxFaceId = max(faceIds) maxFaceId = max(faceIds)
maxCurveId = max(curveIds) maxCurveId = max(curveIds)
maxNodeId = max(nodeIds) maxNodeId = max(nodeIds)
# Reverse mapping from curve id to local curve arrays # Reverse mapping from curve id to local curve arrays
faceMap = [-1 for i in xrange(maxFaceId+1)] faceMap = [-1 for i in xrange(maxFaceId+1)]
for localId, id in enumerate(faceIds): for localId, id in enumerate(faceIds):
faceMap[id] = localId faceMap[id] = localId
curveMap = [-1 for i in xrange(maxCurveId+1)] curveMap = [-1 for i in xrange(maxCurveId+1)]
for localId, id in enumerate(curveIds): for localId, id in enumerate(curveIds):
curveMap[id] = localId curveMap[id] = localId
nodeMap = [-1 for i in xrange(maxNodeId+1)] nodeMap = [-1 for i in xrange(maxNodeId+1)]
for localId, id in enumerate(nodeIds): for localId, id in enumerate(nodeIds):
nodeMap[id] = localId nodeMap[id] = localId
# Get curves on each face # Get curves on each face
faceCurveIds = [[curveMap[id] for id in geompy.GetSubShapesIDs( faceCurveIds = [[curveMap[id] for id in geompy.GetSubShapesIDs(
body, body,
geompy.SubShapeAll(face, geompy.ShapeType["EDGE"]) geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
)] for face in faces] )] for face in faces]
# Get faces attached to each curve # Get faces attached to each curve
curveFaceIds = [[] for id in curveIds] curveFaceIds = [[] for id in curveIds]
for faceI, ids in enumerate(faceCurveIds): for faceI, ids in enumerate(faceCurveIds):
for id in ids: for id in ids:
curveFaceIds[id].append(faceI) curveFaceIds[id].append(faceI)
# Now that we have the connectivity for curves and faces find the # Now that we have the connectivity for curves and faces find the
# feature edges # feature edges
featureEdgeIds = [] featureEdgeIds = []
@ -87,21 +87,21 @@ def extractFeatureEdges(body, minFeatureAngle = 5):
angle = geompy.GetAngle(n1, n2) angle = geompy.GetAngle(n1, n2)
if angle > minFeatureAngle: if angle > minFeatureAngle:
featureEdgeIds.append(curveId) featureEdgeIds.append(curveId)
elif len(adjFaceIds) == 1: elif len(adjFaceIds) == 1:
# Curve on standalone face - Add by default # Curve on standalone face - Add by default
featureEdgeIds.append(curveId) featureEdgeIds.append(curveId)
elif len(adjFaceIds) == 0: elif len(adjFaceIds) == 0:
# Standalone curve - Ignore # Standalone curve - Ignore
None None
else: else:
raise RuntimeError('Curve found sharing %d faces. This is unexpected for fully enclosed bodies.' % len(adjFaceIds)) raise RuntimeError('Curve found sharing %d faces. This is unexpected for fully enclosed bodies.' % len(adjFaceIds))
# Done # Done
print "%d feature edges found" % len(featureEdgeIds) print "%d feature edges found" % len(featureEdgeIds)
return featureEdgeIds return featureEdgeIds
@ -110,22 +110,22 @@ def extractFeatureEdges(body, minFeatureAngle = 5):
if __name__ == '__main__': if __name__ == '__main__':
import salome import salome
salome.salome_init() salome.salome_init()
import GEOM import GEOM
from salome.geom import geomBuilder from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy) geompy = geomBuilder.New(salome.myStudy)
# Get current GUI selection # Get current GUI selection
selected = salome.sg.getAllSelected() selected = salome.sg.getAllSelected()
if len(selected) != 1: if len(selected) != 1:
raise RuntimeError('A single solid, shell or face object must be selected.') raise RuntimeError('A single solid, shell or face object must be selected.')
body = salome.myStudy.FindObjectID(selected[0]).GetObject() body = salome.myStudy.FindObjectID(selected[0]).GetObject()
# Get feature edges and add to the group 'featureEdges' # Get feature edges and add to the group 'featureEdges'
featureEdges = geompy.CreateGroup(body, geompy.ShapeType["EDGE"]) featureEdges = geompy.CreateGroup(body, geompy.ShapeType["EDGE"])
geompy.UnionIDs(featureEdges, extractFeatureEdges(body)) geompy.UnionIDs(featureEdges, extractFeatureEdges(body))
geompy.addToStudyInFather(body, featureEdges, 'featureEdges') geompy.addToStudyInFather(body, featureEdges, 'featureEdges')
if salome.sg.hasDesktop(): if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View file

@ -52,28 +52,28 @@ class triSurf:
from salome.smesh import smeshBuilder from salome.smesh import smeshBuilder
from operator import itemgetter from operator import itemgetter
from collections import OrderedDict from collections import OrderedDict
import SMESH, SALOMEDS import SMESH, SALOMEDS
# ============================================================================= # =============================================================================
# Get the Salome mesh object # Get the Salome mesh object
if object is None: if object is None:
selected = salome.sg.getAllSelected() selected = salome.sg.getAllSelected()
if len(selected) != 1: if len(selected) != 1:
raise RuntimeError('A single Salome mesh object must be selected.') raise RuntimeError('A single Salome mesh object must be selected.')
object = salome.myStudy.FindObjectID(selected[0]).GetObject() object = salome.myStudy.FindObjectID(selected[0]).GetObject()
try: try:
object.GetMesh() object.GetMesh()
except: except:
raise RuntimeError('Supplied object is not a Salome SMESH mesh.') raise RuntimeError('Supplied object is not a Salome SMESH mesh.')
smesh = smeshBuilder.New(salome.myStudy) smesh = smeshBuilder.New(salome.myStudy)
mesh = smesh.Mesh(object) mesh = smesh.Mesh(object)
print "Converting SMESH Mesh '%s'" % mesh.GetName() print "Converting SMESH Mesh '%s'" % mesh.GetName()
# ============================================================================= # =============================================================================
# Get basic mesh info # Get basic mesh info
nNodes = mesh.NbNodes() nNodes = mesh.NbNodes()
@ -83,11 +83,11 @@ class triSurf:
nodeIds = mesh.GetNodesId() nodeIds = mesh.GetNodesId()
faceIds = mesh.GetElementsByType(SMESH.FACE) faceIds = mesh.GetElementsByType(SMESH.FACE)
edgeIds = mesh.GetElementsByType(SMESH.EDGE) edgeIds = mesh.GetElementsByType(SMESH.EDGE)
# Check that mesh is strictly triangular # Check that mesh is strictly triangular
if nFaces != nTris: if nFaces != nTris:
raise RuntimeError('Mesh is not strictly triangular') raise RuntimeError('Mesh is not strictly triangular')
# Get patch and subset names & ids # Get patch and subset names & ids
# All SMESH.FACE groups are assumed to be patches # All SMESH.FACE groups are assumed to be patches
# All SMESH.EDGE groups are assumed to be feature subsets # All SMESH.EDGE groups are assumed to be feature subsets
@ -95,7 +95,7 @@ class triSurf:
patches = OrderedDict() patches = OrderedDict()
pointSubsets = OrderedDict() pointSubsets = OrderedDict()
featureEdgeSubsets = OrderedDict() featureEdgeSubsets = OrderedDict()
for group in mesh.GetGroups(): for group in mesh.GetGroups():
if group.GetType() == SMESH.FACE: if group.GetType() == SMESH.FACE:
patches[group.GetName()] = group.GetIDs() patches[group.GetName()] = group.GetIDs()
@ -103,7 +103,7 @@ class triSurf:
featureEdgeSubsets[group.GetName()] = group.GetIDs() featureEdgeSubsets[group.GetName()] = group.GetIDs()
elif group.GetType() == SMESH.NODE: elif group.GetType() == SMESH.NODE:
pointSubsets[group.GetName()] = group.GetIDs() pointSubsets[group.GetName()] = group.GetIDs()
# ============================================================================= # =============================================================================
# Process faces and patches # Process faces and patches
# Get patchId for each face # Get patchId for each face
@ -117,44 +117,44 @@ class triSurf:
else: else:
print "Face %d is assigned to both groups %s and %s" % (faceId, name, patches.keys()[patchIds[faceId-1]]) 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.') raise RuntimeError('Groups of faces are not unique, i.e. they overlap.')
patchId += 1 patchId += 1
# Compact and reorder patchIds to match faceIds # Compact and reorder patchIds to match faceIds
patchIds = [patchIds[faceId-1] for faceId in faceIds] patchIds = [patchIds[faceId-1] for faceId in faceIds]
# Reorder faces by increasing group id # Reorder faces by increasing group id
faceAndpatchIds = sorted(zip(faceIds, patchIds), key=itemgetter(1)) faceAndpatchIds = sorted(zip(faceIds, patchIds), key=itemgetter(1))
faceIds, patchIds = zip(*faceAndpatchIds) faceIds, patchIds = zip(*faceAndpatchIds)
# Add unused faces to the default patch # Add unused faces to the default patch
defaultFaces = [faceId for faceId, patchId in faceAndpatchIds if patchId == lastPatchId] defaultFaces = [faceId for faceId, patchId in faceAndpatchIds if patchId == lastPatchId]
if len(defaultFaces) > 0: if len(defaultFaces) > 0:
patches['defaultFaces'] = defaultFaces patches['defaultFaces'] = defaultFaces
defaultFaces = None defaultFaces = None
# ============================================================================= # =============================================================================
# Process feature edges # Process feature edges
if not allEdges: if not allEdges:
edgeIds = [] edgeIds = []
for name, ids in featureEdgeSubsets.iteritems(): for name, ids in featureEdgeSubsets.iteritems():
edgeIds += ids edgeIds += ids
edgeIds = list(set(edgeIds)) edgeIds = list(set(edgeIds))
nEdges = len(edgeIds) nEdges = len(edgeIds)
# Reverse mapping of edge ids since they aren't necessarily numbered 1..nEdges # Reverse mapping of edge ids since they aren't necessarily numbered 1..nEdges
if len(edgeIds): if len(edgeIds):
edgeMap = [-1] * max(edgeIds) edgeMap = [-1] * max(edgeIds)
else: else:
edgeMap = [] edgeMap = []
i=0 i=0
for edgeId in edgeIds: for edgeId in edgeIds:
edgeMap[edgeId-1] = i edgeMap[edgeId-1] = i
i += 1 i += 1
# ============================================================================= # =============================================================================
# Process nodes # Process nodes
# Reverse mapping of node ids since nodes aren't necessarily numbered 1..nNodes # Reverse mapping of node ids since nodes aren't necessarily numbered 1..nNodes
@ -163,77 +163,77 @@ class triSurf:
for nodeId in nodeIds: for nodeId in nodeIds:
nodeMap[nodeId-1] = i nodeMap[nodeId-1] = i
i += 1 i += 1
# ============================================================================= # =============================================================================
self._mesh = mesh self._mesh = mesh
self._nodeIds = nodeIds self._nodeIds = nodeIds
self._edgeIds = edgeIds self._edgeIds = edgeIds
self._faceIds = faceIds self._faceIds = faceIds
self._nodeMap = nodeMap self._nodeMap = nodeMap
self._edgeMap = edgeMap self._edgeMap = edgeMap
self._faceMap = [] self._faceMap = []
self._patches = patches self._patches = patches
self._pointSubsets = pointSubsets self._pointSubsets = pointSubsets
self._featureEdgeSubsets = featureEdgeSubsets self._featureEdgeSubsets = featureEdgeSubsets
self._faceSubsets = {} self._faceSubsets = {}
print 'Done' print 'Done'
def nNodes(self): def nNodes(self):
''' '''
Return the number of nodes Return the number of nodes
''' '''
return len(self._nodeIds) return len(self._nodeIds)
def nEdges(self): def nEdges(self):
''' '''
Return the number of edges Return the number of edges
''' '''
return len(self._edgeIds) return len(self._edgeIds)
def nFacets(self): def nFacets(self):
''' '''
Return the number of triangular facets Return the number of triangular facets
''' '''
return len(self._faceIds) return len(self._faceIds)
def nPatches(self): def nPatches(self):
''' '''
Return the number of patches Return the number of patches
''' '''
return len(self._patches) return len(self._patches)
def _writePatchDefs(self, f, typeName = 'wall'): def _writePatchDefs(self, f, typeName = 'wall'):
''' '''
Write the patch definitions to file as an OpenFOAM geometricSurfacePatchList. Write the patch definitions to file as an OpenFOAM geometricSurfacePatchList.
NOTE: All patches are assumed to be walls. NOTE: All patches are assumed to be walls.
''' '''
patches = self._patches patches = self._patches
f.write('%d\n(\n' % len(patches)) f.write('%d\n(\n' % len(patches))
for name in patches.iterkeys(): for name in patches.iterkeys():
f.write('%s\t%s\n' % (name, typeName)) f.write('%s\t%s\n' % (name, typeName))
f.write(')\n') f.write(')\n')
def _writeNodes(self, f): def _writeNodes(self, f):
''' '''
Write the nodes to file as an OpenFOAM pointField. Write the nodes to file as an OpenFOAM pointField.
''' '''
mesh = self._mesh mesh = self._mesh
nodeIds = self._nodeIds nodeIds = self._nodeIds
f.write('%d\n(\n' % len(nodeIds)) f.write('%d\n(\n' % len(nodeIds))
for x, y, z in [mesh.GetNodeXYZ(nodeId) for nodeId in nodeIds]: for x, y, z in [mesh.GetNodeXYZ(nodeId) for nodeId in nodeIds]:
f.write( '( %g %g %g )\n' % (x, y, z)) f.write( '( %g %g %g )\n' % (x, y, z))
f.write(')\n') f.write(')\n')
def _writeFeatureEdges(self, f): def _writeFeatureEdges(self, f):
''' '''
Write the feature edges to file as an OpenFOAM edgeList. Write the feature edges to file as an OpenFOAM edgeList.
@ -241,35 +241,35 @@ class triSurf:
mesh = self._mesh mesh = self._mesh
nodeMap = self._nodeMap nodeMap = self._nodeMap
edgeIds = self._edgeIds edgeIds = self._edgeIds
f.write('%d\n(\n' % len(edgeIds)) f.write('%d\n(\n' % len(edgeIds))
for edgeId in edgeIds: for edgeId in edgeIds:
nodes = mesh.GetElemNodes(edgeId) nodes = mesh.GetElemNodes(edgeId)
f.write( '(' + ' '.join([str(nodeMap[nodeId-1]) for nodeId in nodes]) + ')\n') f.write( '(' + ' '.join([str(nodeMap[nodeId-1]) for nodeId in nodes]) + ')\n')
f.write(')\n') f.write(')\n')
def _writeFacets(self, f): def _writeFacets(self, f):
''' '''
Write the facets to file as an OpenFOAM List of labelledTri. Write the facets to file as an OpenFOAM List of labelledTri.
''' '''
from itertools import chain from itertools import chain
mesh = self._mesh mesh = self._mesh
nodeMap = self._nodeMap nodeMap = self._nodeMap
patches = self._patches patches = self._patches
f.write('%d\n(\n' % sum([len(patch) for patch in patches.itervalues()])) f.write('%d\n(\n' % sum([len(patch) for patch in patches.itervalues()]))
patchId = 0 patchId = 0
for patchId, (patchName, faceIds) in enumerate(patches.iteritems()): for patchId, (patchName, faceIds) in enumerate(patches.iteritems()):
for faceId in faceIds: for faceId in faceIds:
nodes = mesh.GetElemNodes(faceId) nodes = mesh.GetElemNodes(faceId)
f.write( '((' + ' '.join([str(nodeMap[nodeId-1]) for nodeId in nodes]) + ') %d)\n' % patchId) f.write( '((' + ' '.join([str(nodeMap[nodeId-1]) for nodeId in nodes]) + ') %d)\n' % patchId)
f.write(')\n') f.write(')\n')
def _writeSubsets(self, f, subsets, map, typeId): def _writeSubsets(self, f, subsets, map, typeId):
''' '''
General function to write a subset to file as an OpenFOAM Map<meshSubset>. General function to write a subset to file as an OpenFOAM Map<meshSubset>.
@ -277,72 +277,72 @@ class triSurf:
f.write('%d\n(\n' % len(subsets)) f.write('%d\n(\n' % len(subsets))
for name, ids in subsets.iteritems(): 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('%s %s %d ( %s )\n' % (name, typeId, len(ids), ' '.join([str(map[id-1]) for id in ids])))
f.write(')\n') f.write(')\n')
def _writePointSubsets(self, f): def _writePointSubsets(self, f):
''' '''
Write the point subsets to file as and OpenFOAM Map<meshSubset>. Write the point subsets to file as and OpenFOAM Map<meshSubset>.
''' '''
self._writeSubsets(f, self._pointSubsets, self._nodeMap, '2') self._writeSubsets(f, self._pointSubsets, self._nodeMap, '2')
def _writeFaceSubsets(self, f): def _writeFaceSubsets(self, f):
''' '''
Write the face subsets to file as and OpenFOAM Map<meshSubset>. Write the face subsets to file as and OpenFOAM Map<meshSubset>.
''' '''
self._writeSubsets(f, self._faceSubsets, self._faceMap, '4') self._writeSubsets(f, self._faceSubsets, self._faceMap, '4')
def _writeFeatureEdgeSubsets(self, f): def _writeFeatureEdgeSubsets(self, f):
''' '''
Write the feature edge subsets to file as and OpenFOAM Map<meshSubset>. Write the feature edge subsets to file as and OpenFOAM Map<meshSubset>.
''' '''
self._writeSubsets(f, self._featureEdgeSubsets, self._edgeMap, '8') self._writeSubsets(f, self._featureEdgeSubsets, self._edgeMap, '8')
def writeEdgeMesh(self, fileName): def writeEdgeMesh(self, fileName):
''' '''
Write to file as an OpenFOAM edgeMesh Write to file as an OpenFOAM edgeMesh
fileName - The file name to write fileName - The file name to write
''' '''
# Create file # Create file
f = open(fileName, 'wb') # NOTE: file opened as binary to ensure unix-style line breaks f = open(fileName, 'wb') # NOTE: file opened as binary to ensure unix-style line breaks
# Write header # Write header
f.write(foamHeader('edgeMesh', self._mesh.GetName())) f.write(foamHeader('edgeMesh', self._mesh.GetName()))
self._writeNodes(f) self._writeNodes(f)
self._writeFeatureEdges(f) self._writeFeatureEdges(f)
f.close() f.close()
print 'edgeMesh written to %s' % fileName print 'edgeMesh written to %s' % fileName
def writeFtr(self, fileName): def writeFtr(self, fileName):
''' '''
Write to file as an OpenFOAM cfMesh FTR file Write to file as an OpenFOAM cfMesh FTR file
fileName - the file name to write fileName - the file name to write
''' '''
# Create file # Create file
f = open(fileName, 'wb') # NOTE: file opened as binary to ensure unix-style line breaks f = open(fileName, 'wb') # NOTE: file opened as binary to ensure unix-style line breaks
self._writePatchDefs(f) self._writePatchDefs(f)
self._writeNodes(f) self._writeNodes(f)
self._writeFacets(f) self._writeFacets(f)
f.close() f.close()
print 'triSurf written to %s' % fileName print 'triSurf written to %s' % fileName
def writeFms(self, fileName): def writeFms(self, fileName):
''' '''
Write to file as an OpenFOAM cfMesh FMS file Write to file as an OpenFOAM cfMesh FMS file
fileName - the file name to write fileName - the file name to write
''' '''
# Create file # Create file
f = open(fileName, 'wb') # NOTE: file opened as binary to ensure unix-style line breaks f = open(fileName, 'wb') # NOTE: file opened as binary to ensure unix-style line breaks
self._writePatchDefs(f) self._writePatchDefs(f)
self._writeNodes(f) self._writeNodes(f)
self._writeFacets(f) self._writeFacets(f)
@ -350,14 +350,14 @@ class triSurf:
self._writePointSubsets(f) self._writePointSubsets(f)
self._writeFaceSubsets(f) self._writeFaceSubsets(f)
self._writeFeatureEdgeSubsets(f) self._writeFeatureEdgeSubsets(f)
f.close() f.close()
print 'triSurf written to %s' % fileName print 'triSurf written to %s' % fileName
if __name__ == '__main__': if __name__ == '__main__':
import salome import salome
salome.salome_init() salome.salome_init()
import SMESH, SALOMEDS import SMESH, SALOMEDS

View file

@ -22,7 +22,7 @@ License
along with cfMesh. If not, see <http://www.gnu.org/licenses/>. along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description Description
Reads the specified surface and writes it in the fms format. Reads the specified surface and writes it in the fms format.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View file

@ -1 +1 @@
find . ! -name 'All*' | xargs rm -rf find . ! -name 'All*' | xargs rm -rf

View file

@ -246,7 +246,7 @@ public:
inline dimensionedScalar rotAngle() const; inline dimensionedScalar rotAngle() const;
// Non-constant access to // Non-constant access to
//- Set position of origin //- Set position of origin
inline void setXrel(const vector& x); inline void setXrel(const vector& x);

View file

@ -113,7 +113,7 @@ public:
{ {
return source_; return source_;
} }
// Member operators // Member operators

View file

@ -112,7 +112,7 @@ gradScheme<Type>::fvmGrad
( (
"tmp<BlockLduSystem> gradScheme<Type>::fvmGrad\n" "tmp<BlockLduSystem> gradScheme<Type>::fvmGrad\n"
"(\n" "(\n"
" GeometricField<Type, fvPatchField, volMesh>&" " GeometricField<Type, fvPatchField, volMesh>&"
")\n" ")\n"
) << "Implicit gradient operator currently defined only for Gauss linear " ) << "Implicit gradient operator currently defined only for Gauss linear "
<< "and leastSquares (cell and face limiters are optional)." << "and leastSquares (cell and face limiters are optional)."

View file

@ -97,7 +97,7 @@ public:
const GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
) const; ) const;
//- Return the BlockLduSystem corresponding to the implicit least //- Return the BlockLduSystem corresponding to the implicit least
// quares grad discretization. For block coupled systems. // quares grad discretization. For block coupled systems.
tmp tmp
< <

View file

@ -312,7 +312,7 @@ void Foam::fvBlockMatrix<Type>::updateCouplingCoeffs
const Field<matrixType>& icp = matrix.internalCoeffs()[patchI]; const Field<matrixType>& icp = matrix.internalCoeffs()[patchI];
const Field<matrixType>& bcp = matrix.boundaryCoeffs()[patchI]; const Field<matrixType>& bcp = matrix.boundaryCoeffs()[patchI];
if if
( (
this->coupleUpper()[patchI].activeType() this->coupleUpper()[patchI].activeType()
!= blockCoeffBase::SQUARE != blockCoeffBase::SQUARE

View file

@ -219,7 +219,7 @@ public:
const bool incrementColumnDir const bool incrementColumnDir
); );
//- Insert scalar equation coupling into this fvBlockMatrix //- Insert scalar equation coupling into this fvBlockMatrix
// Source compensation is done in function updateSourceCoupling() // Source compensation is done in function updateSourceCoupling()
// after all coupling terms are added. HJ, 27/Apr/2015 // after all coupling terms are added. HJ, 27/Apr/2015
void insertEquationCoupling void insertEquationCoupling
@ -228,7 +228,7 @@ public:
const direction dirJ, const direction dirJ,
const scalarField& coeffIJ const scalarField& coeffIJ
); );
//- Add field into block field //- Add field into block field
void blockAdd void blockAdd
( (
@ -239,7 +239,7 @@ public:
//- Update coupling of block system. //- Update coupling of block system.
// Subtracts the block-coefficient coupling as specified by the // Subtracts the block-coefficient coupling as specified by the
// user from the source, leaving the implicit update given by // user from the source, leaving the implicit update given by
// linearisation // linearisation
void updateSourceCoupling(); void updateSourceCoupling();

View file

@ -156,7 +156,7 @@ Foam::immersedBoundaryFvPatch::toIbPoints
// const labelledTri& tri = faces[hf[cellI]]; // const labelledTri& tri = faces[hf[cellI]];
// triPointRef triPt = faces[hf[cellI]].tri(triPoints); // triPointRef triPt = faces[hf[cellI]].tri(triPoints);
// ibPsi[cellI] = // ibPsi[cellI] =
// triValues[tri[0]]*triPt.Ni(0, p[cellI]) // triValues[tri[0]]*triPt.Ni(0, p[cellI])
// + triValues[tri[1]]*triPt.Ni(1, p[cellI]) // + triValues[tri[1]]*triPt.Ni(1, p[cellI])
// + triValues[tri[2]]*triPt.Ni(2, p[cellI]); // + triValues[tri[2]]*triPt.Ni(2, p[cellI]);

View file

@ -651,7 +651,7 @@ void immersedBoundaryFvPatchField<Type>::correctOffDiag
eqn.internalCoeffs()[patchi][patchFacei] = eqn.internalCoeffs()[patchi][patchFacei] =
pTraits<Type>::zero; pTraits<Type>::zero;
eqn.boundaryCoeffs()[patchi][patchFacei] = eqn.boundaryCoeffs()[patchi][patchFacei] =
pTraits<Type>::zero; pTraits<Type>::zero;
@ -717,7 +717,7 @@ void immersedBoundaryFvPatchField<Type>::motionUpdate() const
template<class Type> template<class Type>
void immersedBoundaryFvPatchField<Type>::setIbCellValues void immersedBoundaryFvPatchField<Type>::setIbCellValues
( (
const Field<Type>& ibcValues const Field<Type>& ibcValues
) const ) const
{ {
const labelList& ibc = ibPatch_.ibCells(); const labelList& ibc = ibPatch_.ibCells();

View file

@ -258,7 +258,7 @@ void immersedBoundaryOmegaWallFunctionFvPatchScalarField::updateCoeffs()
if (yPlusSample > yPlusLam) if (yPlusSample > yPlusLam)
{ {
// Calculate tauW from log-law using k and U at sampling point // Calculate tauW from log-law using k and U at sampling point
tauW = UtanOld[ibCellI]*Cmu25*sqrt(k[ibCellI])*kappa_ tauW = UtanOld[ibCellI]*Cmu25*sqrt(k[ibCellI])*kappa_
/log(E_*yPlusSample); /log(E_*yPlusSample);
} }
@ -288,12 +288,12 @@ void immersedBoundaryOmegaWallFunctionFvPatchScalarField::updateCoeffs()
G[ibc[ibCellI]] = G[ibc[ibCellI]] =
sqr((nutw + nuLam)*magGradUw[ibCellI])/ sqr((nutw + nuLam)*magGradUw[ibCellI])/
(Cmu25*sqrt(k[ibCellI])*kappa_*y[ibCellI]); (Cmu25*sqrt(k[ibCellI])*kappa_*y[ibCellI]);
// Compute k at the IB cell // Compute k at the IB cell
kNew[ibCellI] = tauW/Cmu50; // equilibrium boundary layer kNew[ibCellI] = tauW/Cmu50; // equilibrium boundary layer
// kNew[ibCellI] = k[ibCellI]; // zero-Gradient (less stable) // kNew[ibCellI] = k[ibCellI]; // zero-Gradient (less stable)
// Compute omega at the IB cell // Compute omega at the IB cell
omegaNew[ibCellI] = sqrt(kNew[ibCellI])/(Cmu25*kappa_*y[ibCellI]); omegaNew[ibCellI] = sqrt(kNew[ibCellI])/(Cmu25*kappa_*y[ibCellI]);
// Log-Law for tangential velocity - uTau = Cmu25*sqrt(kNew) // Log-Law for tangential velocity - uTau = Cmu25*sqrt(kNew)
@ -313,7 +313,7 @@ void immersedBoundaryOmegaWallFunctionFvPatchScalarField::updateCoeffs()
// quadratic fit // quadratic fit
kNew[ibCellI] = k[ibCellI]*sqr(yPlusIB/yPlusLam); kNew[ibCellI] = k[ibCellI]*sqr(yPlusIB/yPlusLam);
// Compute omega at the IB cell // Compute omega at the IB cell
omegaNew[ibCellI] = 6.0*nu[ibCellI]/(beta1_*sqr(y[ibCellI])); omegaNew[ibCellI] = 6.0*nu[ibCellI]/(beta1_*sqr(y[ibCellI]));
// Laminar sub-layer for tangential velocity: uPlus = yPlus // Laminar sub-layer for tangential velocity: uPlus = yPlus

View file

@ -42,7 +42,7 @@ namespace RASModels
void immersedBoundaryVelocityWallFunctionFvPatchVectorField::setIbCellValues void immersedBoundaryVelocityWallFunctionFvPatchVectorField::setIbCellValues
( (
const vectorField& ibcValues const vectorField& ibcValues
) const ) const
{ {
const labelList& ibc = ibPatch().ibCells(); const labelList& ibc = ibPatch().ibCells();

View file

@ -53,7 +53,7 @@ void immersedBoundaryWallFunctionFvPatchField<Type>::motionUpdate() const
template<class Type> template<class Type>
void immersedBoundaryWallFunctionFvPatchField<Type>::setIbCellValues void immersedBoundaryWallFunctionFvPatchField<Type>::setIbCellValues
( (
const Field<Type>& ibcValues const Field<Type>& ibcValues
) const ) const
{ {
const labelList& ibc = this->ibPatch().ibCells(); const labelList& ibc = this->ibPatch().ibCells();

View file

@ -76,24 +76,24 @@ void cartesianMeshExtractor::decomposeSplitHexes()
void cartesianMeshExtractor::createMesh() void cartesianMeshExtractor::createMesh()
{ {
Info << "Extracting polyMesh" << endl; Info << "Extracting polyMesh" << endl;
//- create points and pointLeaves addressing //- create points and pointLeaves addressing
createPointsAndAddressing(); createPointsAndAddressing();
//- create the mesh //- create the mesh
createPolyMesh(); createPolyMesh();
//- decompose split-hex cells into tetrahedra and pyramids //- decompose split-hex cells into tetrahedra and pyramids
decomposeSplitHexesIntoTetsAndPyramids(); decomposeSplitHexesIntoTetsAndPyramids();
//- remove unused vertices //- remove unused vertices
polyMeshGenModifier(mesh_).removeUnusedVertices(); polyMeshGenModifier(mesh_).removeUnusedVertices();
Info << "Mesh has :" << nl Info << "Mesh has :" << nl
<< mesh_.points().size() << " vertices " << nl << mesh_.points().size() << " vertices " << nl
<< mesh_.faces().size() << " faces" << nl << mesh_.faces().size() << " faces" << nl
<< mesh_.cells().size() << " cells" << endl; << mesh_.cells().size() << " cells" << endl;
if( Pstream::parRun() ) if( Pstream::parRun() )
{ {
label nCells = mesh_.cells().size(); label nCells = mesh_.cells().size();
@ -112,7 +112,7 @@ void cartesianMeshExtractor::createMesh()
<< " This can be reolved by reducing the maxCellSize by a fraction." << " This can be reolved by reducing the maxCellSize by a fraction."
<< "i.e. 2.49999 instead of 2.5." << exit(FatalError); << "i.e. 2.49999 instead of 2.5." << exit(FatalError);
} }
Info << "Finished extracting polyMesh" << endl; Info << "Finished extracting polyMesh" << endl;
} }

View file

@ -42,7 +42,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
class IOdictionary; class IOdictionary;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -54,13 +54,13 @@ class cartesianMeshExtractor
// Private data // Private data
//- reference to the octree addressing //- reference to the octree addressing
meshOctreeAddressing octreeCheck_; meshOctreeAddressing octreeCheck_;
//- reference to the mesh //- reference to the mesh
polyMeshGen& mesh_; polyMeshGen& mesh_;
//- decompose split hex cells //- decompose split hex cells
bool decomposeSplitHexes_; bool decomposeSplitHexes_;
//- cell label for a given leaf //- cell label for a given leaf
labelList* leafCellLabelPtr_; labelList* leafCellLabelPtr_;
@ -73,7 +73,7 @@ class cartesianMeshExtractor
//- create mesh data //- create mesh data
void createPolyMesh(); void createPolyMesh();
//- decompose split hexes into pyramids and tets //- decompose split hexes into pyramids and tets
void decomposeSplitHexesIntoTetsAndPyramids(); void decomposeSplitHexesIntoTetsAndPyramids();
@ -105,7 +105,7 @@ public:
//- decompose split hexes into standard cells //- decompose split hexes into standard cells
void decomposeSplitHexes(); void decomposeSplitHexes();
//- create the mesh with the above options //- create the mesh with the above options
void createMesh(); void createMesh();
}; };

View file

@ -45,39 +45,39 @@ void cartesianMeshExtractor::decomposeSplitHexesIntoTetsAndPyramids()
if( !decomposeSplitHexes_ ) return; if( !decomposeSplitHexes_ ) return;
Info << "Decomposing split-hex cells" << endl; Info << "Decomposing split-hex cells" << endl;
const faceListPMG& faces = mesh_.faces(); const faceListPMG& faces = mesh_.faces();
//- decompose faces which have more than 4 vertices //- decompose faces which have more than 4 vertices
boolList decompose(faces.size(), false); boolList decompose(faces.size(), false);
label nDecomposed(0); label nDecomposed(0);
forAll(faces, faceI) forAll(faces, faceI)
{ {
if( faces[faceI].size() > 4 ) if( faces[faceI].size() > 4 )
{ {
++nDecomposed; ++nDecomposed;
decompose[faceI] = true; decompose[faceI] = true;
} }
} }
reduce(nDecomposed, sumOp<label>()); reduce(nDecomposed, sumOp<label>());
Info << "Decomposing " << nDecomposed Info << "Decomposing " << nDecomposed
<< " faces with more than 4 vertices" << endl; << " faces with more than 4 vertices" << endl;
if( nDecomposed != 0 ) if( nDecomposed != 0 )
{ {
//- decompose marked faces into triangles //- decompose marked faces into triangles
decomposeFaces(mesh_).decomposeMeshFaces(decompose); decomposeFaces(mesh_).decomposeMeshFaces(decompose);
} }
//- decompose cells with 24 faces //- decompose cells with 24 faces
const cellListPMG& cells = mesh_.cells(); const cellListPMG& cells = mesh_.cells();
decompose.setSize(cells.size()); decompose.setSize(cells.size());
decompose = false; decompose = false;
hexMatcher hex; hexMatcher hex;
forAll(cells, cellI) forAll(cells, cellI)
{ {
@ -87,19 +87,19 @@ void cartesianMeshExtractor::decomposeSplitHexesIntoTetsAndPyramids()
decompose[cellI] = true; decompose[cellI] = true;
} }
} }
reduce(nDecomposed, sumOp<label>()); reduce(nDecomposed, sumOp<label>());
Info << "Decomposing " << nDecomposed Info << "Decomposing " << nDecomposed
<< " cells into tetrahedra and pyramids" << endl; << " cells into tetrahedra and pyramids" << endl;
if( nDecomposed ) if( nDecomposed )
{ {
//- decompose marked cells into tets and pyramids //- decompose marked cells into tets and pyramids
decomposeCells dc(mesh_); decomposeCells dc(mesh_);
dc.decomposeMesh(decompose); dc.decomposeMesh(decompose);
} }
Info << "Finished decomposing split-hex cells" << endl; Info << "Finished decomposing split-hex cells" << endl;
} }

View file

@ -46,25 +46,25 @@ void boundaryLayers::checkTopologyOfBoundaryFaces(const labelList& patchLabels)
{ {
if( !patchWiseLayers_ ) if( !patchWiseLayers_ )
return; return;
Info << "Checking topology of boundary faces" << endl; Info << "Checking topology of boundary faces" << endl;
labelHashSet usedPatches; labelHashSet usedPatches;
forAll(patchLabels, i) forAll(patchLabels, i)
usedPatches.insert(patchLabels[i]); usedPatches.insert(patchLabels[i]);
//- create a set of patch pairs. These are pairs at which the layers //- create a set of patch pairs. These are pairs at which the layers
//- shall be terminated //- shall be terminated
std::set<std::pair<label, label> > terminatedPairs; std::set<std::pair<label, label> > terminatedPairs;
forAll(treatPatchesWithPatch_, patchI) forAll(treatPatchesWithPatch_, patchI)
{ {
const DynList<label>& otherPatches = treatPatchesWithPatch_[patchI]; const DynList<label>& otherPatches = treatPatchesWithPatch_[patchI];
forAll(otherPatches, patchJ) forAll(otherPatches, patchJ)
{ {
if( patchI == otherPatches[patchJ] ) if( patchI == otherPatches[patchJ] )
continue; continue;
terminatedPairs.insert terminatedPairs.insert
( (
std::make_pair std::make_pair
@ -75,48 +75,48 @@ void boundaryLayers::checkTopologyOfBoundaryFaces(const labelList& patchLabels)
); );
} }
} }
bool changed; bool changed;
label nDecomposed(0); label nDecomposed(0);
boolList decomposeCell(mesh_.cells().size(), false); boolList decomposeCell(mesh_.cells().size(), false);
do do
{ {
changed = false; changed = false;
const meshSurfaceEngine& mse = this->surfaceEngine(); const meshSurfaceEngine& mse = this->surfaceEngine();
const faceList::subList& bFaces = mse.boundaryFaces(); const faceList::subList& bFaces = mse.boundaryFaces();
const labelList& faceOwner = mse.faceOwners(); const labelList& faceOwner = mse.faceOwners();
const labelList& facePatches = mse.boundaryFacePatches(); const labelList& facePatches = mse.boundaryFacePatches();
const VRWGraph& faceEdges = mse.faceEdges(); const VRWGraph& faceEdges = mse.faceEdges();
const VRWGraph& edgeFaces = mse.edgeFaces(); const VRWGraph& edgeFaces = mse.edgeFaces();
const Map<label>& otherProcPatch = mse.otherEdgeFacePatch(); const Map<label>& otherProcPatch = mse.otherEdgeFacePatch();
VRWGraph newBoundaryFaces; VRWGraph newBoundaryFaces;
labelLongList newBoundaryOwners; labelLongList newBoundaryOwners;
labelLongList newBoundaryPatches; labelLongList newBoundaryPatches;
forAll(bFaces, bfI) forAll(bFaces, bfI)
{ {
const face& bf = bFaces[bfI]; const face& bf = bFaces[bfI];
const label fPatch = facePatches[bfI]; const label fPatch = facePatches[bfI];
if( !usedPatches.found(fPatch) ) if( !usedPatches.found(fPatch) )
continue; continue;
//- find patches of neighbour faces //- find patches of neighbour faces
labelList neiPatches(bf.size()); labelList neiPatches(bf.size());
forAll(bf, eI) forAll(bf, eI)
{ {
const label beI = faceEdges(bfI, eI); const label beI = faceEdges(bfI, eI);
if( edgeFaces.sizeOfRow(beI) == 2 ) if( edgeFaces.sizeOfRow(beI) == 2 )
{ {
label neiFace = edgeFaces(beI, 0); label neiFace = edgeFaces(beI, 0);
if( neiFace == bfI ) if( neiFace == bfI )
neiFace = edgeFaces(beI, 1); neiFace = edgeFaces(beI, 1);
neiPatches[eI] = facePatches[neiFace]; neiPatches[eI] = facePatches[neiFace];
} }
else if( edgeFaces.sizeOfRow(beI) == 1 ) else if( edgeFaces.sizeOfRow(beI) == 1 )
@ -125,7 +125,7 @@ void boundaryLayers::checkTopologyOfBoundaryFaces(const labelList& patchLabels)
neiPatches[eI] = otherProcPatch[beI]; neiPatches[eI] = otherProcPatch[beI];
} }
} }
//- find feature edges and check if the patches meeting there //- find feature edges and check if the patches meeting there
//- shall be treated together. //- shall be treated together.
bool storedFace(false); bool storedFace(false);
@ -133,16 +133,16 @@ void boundaryLayers::checkTopologyOfBoundaryFaces(const labelList& patchLabels)
{ {
if( neiPatches[eI] == fPatch ) if( neiPatches[eI] == fPatch )
continue; continue;
std::pair<label, label> pp std::pair<label, label> pp
( (
Foam::min(fPatch, neiPatches[eI]), Foam::min(fPatch, neiPatches[eI]),
Foam::max(fPatch, neiPatches[eI]) Foam::max(fPatch, neiPatches[eI])
); );
if( terminatedPairs.find(pp) == terminatedPairs.end() ) if( terminatedPairs.find(pp) == terminatedPairs.end() )
continue; continue;
//- create a new face from this edge and the neighbouring edges //- create a new face from this edge and the neighbouring edges
bool usePrev(false), useNext(false); bool usePrev(false), useNext(false);
if( neiPatches[neiPatches.rcIndex(eI)] == fPatch ) if( neiPatches[neiPatches.rcIndex(eI)] == fPatch )
@ -156,11 +156,11 @@ void boundaryLayers::checkTopologyOfBoundaryFaces(const labelList& patchLabels)
Foam::min(fPatch, neiPatches[neiPatches.rcIndex(eI)]), Foam::min(fPatch, neiPatches[neiPatches.rcIndex(eI)]),
Foam::max(fPatch, neiPatches[neiPatches.rcIndex(eI)]) Foam::max(fPatch, neiPatches[neiPatches.rcIndex(eI)])
); );
if( terminatedPairs.find(ppPrev) == terminatedPairs.end() ) if( terminatedPairs.find(ppPrev) == terminatedPairs.end() )
usePrev = true; usePrev = true;
} }
if( neiPatches[neiPatches.fcIndex(eI)] == fPatch ) if( neiPatches[neiPatches.fcIndex(eI)] == fPatch )
{ {
useNext = true; useNext = true;
@ -172,11 +172,11 @@ void boundaryLayers::checkTopologyOfBoundaryFaces(const labelList& patchLabels)
Foam::min(fPatch, neiPatches[neiPatches.fcIndex(eI)]), Foam::min(fPatch, neiPatches[neiPatches.fcIndex(eI)]),
Foam::max(fPatch, neiPatches[neiPatches.fcIndex(eI)]) Foam::max(fPatch, neiPatches[neiPatches.fcIndex(eI)])
); );
if( terminatedPairs.find(ppNext) == terminatedPairs.end() ) if( terminatedPairs.find(ppNext) == terminatedPairs.end() )
useNext = true; useNext = true;
} }
DynList<edge> removeEdges; DynList<edge> removeEdges;
if( useNext && usePrev ) if( useNext && usePrev )
{ {
@ -197,7 +197,7 @@ void boundaryLayers::checkTopologyOfBoundaryFaces(const labelList& patchLabels)
removeEdges[0] = bf.faceEdge(neiPatches.rcIndex(eI)); removeEdges[0] = bf.faceEdge(neiPatches.rcIndex(eI));
removeEdges[1] = bf.faceEdge(eI); removeEdges[1] = bf.faceEdge(eI);
} }
const face cutFace = help::removeEdgesFromFace(bf, removeEdges); const face cutFace = help::removeEdgesFromFace(bf, removeEdges);
if( cutFace.size() > 2 ) if( cutFace.size() > 2 )
{ {
@ -212,19 +212,19 @@ void boundaryLayers::checkTopologyOfBoundaryFaces(const labelList& patchLabels)
newBoundaryOwners.append(faceOwner[bfI]); newBoundaryOwners.append(faceOwner[bfI]);
newBoundaryPatches.append(fPatch); newBoundaryPatches.append(fPatch);
} }
if( (cutFace.size() > 2) && (rFace.size() > 2) ) if( (cutFace.size() > 2) && (rFace.size() > 2) )
{ {
decomposeCell[faceOwner[bfI]] = true; decomposeCell[faceOwner[bfI]] = true;
changed = true; changed = true;
++nDecomposed; ++nDecomposed;
} }
storedFace = true; storedFace = true;
break; break;
} }
if( !storedFace ) if( !storedFace )
{ {
newBoundaryFaces.appendList(bf); newBoundaryFaces.appendList(bf);
@ -232,10 +232,10 @@ void boundaryLayers::checkTopologyOfBoundaryFaces(const labelList& patchLabels)
newBoundaryPatches.append(fPatch); newBoundaryPatches.append(fPatch);
} }
} }
//- Finally, replace the boundary faces //- Finally, replace the boundary faces
reduce(changed, maxOp<bool>()); reduce(changed, maxOp<bool>());
if( changed ) if( changed )
{ {
polyMeshGenModifier(mesh_).replaceBoundary polyMeshGenModifier(mesh_).replaceBoundary
@ -245,24 +245,24 @@ void boundaryLayers::checkTopologyOfBoundaryFaces(const labelList& patchLabels)
newBoundaryOwners, newBoundaryOwners,
newBoundaryPatches newBoundaryPatches
); );
clearOut(); clearOut();
} }
} while( changed ); } while( changed );
//- decompose owner cells adjacent to the decomposed faces //- decompose owner cells adjacent to the decomposed faces
reduce(nDecomposed, sumOp<label>()); reduce(nDecomposed, sumOp<label>());
if( nDecomposed != 0 ) if( nDecomposed != 0 )
{ {
FatalError << "Critical. Not tested" << exit(FatalError); FatalError << "Critical. Not tested" << exit(FatalError);
decomposeCells dc(mesh_); decomposeCells dc(mesh_);
dc.decomposeMesh(decomposeCell); dc.decomposeMesh(decomposeCell);
clearOut(); clearOut();
} }
mesh_.write(); mesh_.write();
Info << "Finished checking topology" << endl; Info << "Finished checking topology" << endl;
} }

View file

@ -33,21 +33,21 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void boundaryLayers::addWrapperLayer() void boundaryLayers::addWrapperLayer()
{ {
createOTopologyLayers(); createOTopologyLayers();
if( treatedPatch_[0] ) return; if( treatedPatch_[0] ) return;
const meshSurfaceEngine& mse = surfaceEngine(); const meshSurfaceEngine& mse = surfaceEngine();
const labelList& bPoints = mse.boundaryPoints(); const labelList& bPoints = mse.boundaryPoints();
boolList treatPatches(mesh_.boundaries().size(), true); boolList treatPatches(mesh_.boundaries().size(), true);
labelLongList newLabelForVertex(nPoints_, -1); labelLongList newLabelForVertex(nPoints_, -1);
pointFieldPMG& points = mesh_.points(); pointFieldPMG& points = mesh_.points();
@ -57,13 +57,13 @@ void boundaryLayers::addWrapperLayer()
points[nPoints_] = points[bPoints[bpI]]; points[nPoints_] = points[bPoints[bpI]];
newLabelForVertex[bPoints[bpI]] = nPoints_++; newLabelForVertex[bPoints[bpI]] = nPoints_++;
} }
createNewFacesAndCells(treatPatches); createNewFacesAndCells(treatPatches);
forAll(treatPatches, patchI) forAll(treatPatches, patchI)
if( treatPatches[patchI] ) if( treatPatches[patchI] )
treatedPatch_[patchI] = true; treatedPatch_[patchI] = true;
//- delete surface engine //- delete surface engine
clearOut(); clearOut();
} }

View file

@ -54,51 +54,51 @@ namespace Foam
class extrudeLayer class extrudeLayer
{ {
// Private data // Private data
//- Reference to the mesh //- Reference to the mesh
polyMeshGen& mesh_; polyMeshGen& mesh_;
//- thickness //- thickness
const scalar thickness_; const scalar thickness_;
//- number of points in the original mesh //- number of points in the original mesh
const label nOrigPoints_; const label nOrigPoints_;
//- number of faces in the original mesh //- number of faces in the original mesh
const label nOrigFaces_; const label nOrigFaces_;
//- number of cells in the original mesh //- number of cells in the original mesh
const label nOrigCells_; const label nOrigCells_;
//- pairs of faces making the extruded front //- pairs of faces making the extruded front
LongList<labelPair> extrudedFaces_; LongList<labelPair> extrudedFaces_;
//- store the orientation of the extruded front //- store the orientation of the extruded front
//- true if the pair has the same orientation and false otherwise //- true if the pair has the same orientation and false otherwise
LongList<bool> pairOrientation_; LongList<bool> pairOrientation_;
//- original point label //- original point label
labelLongList origPointLabel_; labelLongList origPointLabel_;
// Private member functions // Private member functions
//- duplicate faces which will be extruded //- duplicate faces which will be extruded
void createDuplicateFrontFaces(const LongList<labelPair>&); void createDuplicateFrontFaces(const LongList<labelPair>&);
//- create new vertices and open the mesh //- create new vertices and open the mesh
void createNewVertices(); void createNewVertices();
//- move points to make space for the new cells //- move points to make space for the new cells
void movePoints(); void movePoints();
//- create layer cells //- create layer cells
void createLayerCells(); void createLayerCells();
//- create new faces at parallel boundaries //- create new faces at parallel boundaries
void createNewFacesParallel(); void createNewFacesParallel();
//- update boundary patches //- update boundary patches
void updateBoundary(); void updateBoundary();
// Nested classes // Nested classes
//- this class provides addressing data needed for generating //- this class provides addressing data needed for generating
//- cells emerging as a consequence of self-intersecting layers //- cells emerging as a consequence of self-intersecting layers
@ -107,18 +107,18 @@ class extrudeLayer
// Private data // Private data
//- const reference to mesh faces //- const reference to mesh faces
const faceListPMG& faces_; const faceListPMG& faces_;
//- const reference to extruded face pairs //- const reference to extruded face pairs
const LongList<labelPair>& extrudedFaces_; const LongList<labelPair>& extrudedFaces_;
//- const reference telling the orientation of each face pair //- const reference telling the orientation of each face pair
LongList<bool> pairOrientation_; LongList<bool> pairOrientation_;
//- const reference to the extruded faces at points //- const reference to the extruded faces at points
const VRWGraph& pointExtruded_; const VRWGraph& pointExtruded_;
public: public:
// Construct from faces, extruded face pairs and // Construct from faces, extruded face pairs and
// point-extrudedfaces addressing // point-extrudedfaces addressing
addressingCalculator addressingCalculator
@ -128,41 +128,41 @@ class extrudeLayer
const LongList<bool>& pairOrientation, const LongList<bool>& pairOrientation,
const VRWGraph& pointFaces const VRWGraph& pointFaces
); );
// Destructor // Destructor
~addressingCalculator(); ~addressingCalculator();
// Member functions // Member functions
//- return label of the original face for the given face //- return label of the original face for the given face
inline label origFaceLabel(const label extrudedI) const; inline label origFaceLabel(const label extrudedI) const;
//- return position of point in extruded face //- return position of point in extruded face
inline label positionInFace inline label positionInFace
( (
const label extrudedI, const label extrudedI,
const label pointI const label pointI
) const; ) const;
//- return point label in the original face //- return point label in the original face
inline label origPointLabel inline label origPointLabel
( (
const label extrudedI, const label extrudedI,
const label pos const label pos
) const; ) const;
inline label origPoint inline label origPoint
( (
const label extrudedI, const label extrudedI,
const label pointI const label pointI
) const; ) const;
//- find face sharing an edge with the given face //- find face sharing an edge with the given face
inline label faceSharingEdge inline label faceSharingEdge
( (
const label extrudedI, const label extrudedI,
const label eI const label eI
) const; ) const;
//- find faces attached to both points //- find faces attached to both points
inline void facesSharingEdge inline void facesSharingEdge
( (
@ -171,7 +171,7 @@ class extrudeLayer
DynList<label>& DynList<label>&
) const; ) const;
}; };
// Enumerators // Enumerators
enum extrudeLayerTypes_ enum extrudeLayerTypes_
{ {
@ -179,17 +179,17 @@ class extrudeLayer
FRONTVERTEX = 1, FRONTVERTEX = 1,
FRONTVERTEXPROCBND = 2 FRONTVERTEXPROCBND = 2
}; };
//- Disallow bitwise copy construct //- Disallow bitwise copy construct
extrudeLayer(const extrudeLayer&); extrudeLayer(const extrudeLayer&);
//- Disallow bitwise assignment //- Disallow bitwise assignment
void operator=(const extrudeLayer&); void operator=(const extrudeLayer&);
public: public:
// Constructors // Constructors
//- Construct from mesh, extrusion faces, thickness and number of layers //- Construct from mesh, extrusion faces, thickness and number of layers
extrudeLayer extrudeLayer
( (
@ -197,10 +197,10 @@ class extrudeLayer
const LongList<labelPair>& extrusionFront, const LongList<labelPair>& extrusionFront,
const scalar thickness = -1.0 const scalar thickness = -1.0
); );
// Destructor // Destructor
~extrudeLayer(); ~extrudeLayer();
// Public member functions // Public member functions
}; };

View file

@ -49,10 +49,10 @@ inline label extrudeLayer::addressingCalculator::positionInFace
) const ) const
{ {
const face& f = faces_[extrudedFaces_[extrudedI].first()]; const face& f = faces_[extrudedFaces_[extrudedI].first()];
return f.which(pointI); return f.which(pointI);
} }
inline label extrudeLayer::addressingCalculator::origPointLabel inline label extrudeLayer::addressingCalculator::origPointLabel
( (
const label extrudedI, const label extrudedI,
@ -60,7 +60,7 @@ inline label extrudeLayer::addressingCalculator::origPointLabel
) const ) const
{ {
const face& of = faces_[extrudedFaces_[extrudedI].second()]; const face& of = faces_[extrudedFaces_[extrudedI].second()];
if( pairOrientation_[extrudedI] ) if( pairOrientation_[extrudedI] )
{ {
return of[pos]; return of[pos];
@ -69,13 +69,13 @@ inline label extrudeLayer::addressingCalculator::origPointLabel
{ {
return of[(of.size()-pos)%of.size()]; return of[(of.size()-pos)%of.size()];
} }
FatalErrorIn FatalErrorIn
( (
"label extrudeLayer::addressingCalculator::origPointLabel" "label extrudeLayer::addressingCalculator::origPointLabel"
"(const label, const label) const" "(const label, const label) const"
) << "Cannot find point for the given position" << abort(FatalError); ) << "Cannot find point for the given position" << abort(FatalError);
return -1; return -1;
} }
@ -88,7 +88,7 @@ inline label extrudeLayer::addressingCalculator::origPoint
const face& f = faces_[extrudedFaces_[extrudedI].first()]; const face& f = faces_[extrudedFaces_[extrudedI].first()];
const face& of = faces_[extrudedFaces_[extrudedI].second()]; const face& of = faces_[extrudedFaces_[extrudedI].second()];
const label pos = f.which(pointI); const label pos = f.which(pointI);
if( pairOrientation_[extrudedI] ) if( pairOrientation_[extrudedI] )
{ {
return of[pos]; return of[pos];
@ -97,13 +97,13 @@ inline label extrudeLayer::addressingCalculator::origPoint
{ {
return of[(of.size()-pos)%of.size()]; return of[(of.size()-pos)%of.size()];
} }
FatalErrorIn FatalErrorIn
( (
"label extrudeLayer::addressingCalculator::origPoint" "label extrudeLayer::addressingCalculator::origPoint"
"(const label, const label) const" "(const label, const label) const"
) << "Cannot find point for the given position" << abort(FatalError); ) << "Cannot find point for the given position" << abort(FatalError);
return -1; return -1;
} }
@ -114,18 +114,18 @@ inline label extrudeLayer::addressingCalculator::faceSharingEdge
) const ) const
{ {
const face& f = faces_[extrudedFaces_[extrudedI].first()]; const face& f = faces_[extrudedFaces_[extrudedI].first()];
const label pointI = f[eI]; const label pointI = f[eI];
const label nextI = f.nextLabel(eI); const label nextI = f.nextLabel(eI);
label otherFace(-1); label otherFace(-1);
forAllRow(pointExtruded_, pointI, pfI) forAllRow(pointExtruded_, pointI, pfI)
{ {
const label currFaceI = pointExtruded_(pointI, pfI); const label currFaceI = pointExtruded_(pointI, pfI);
if( currFaceI == extrudedI ) if( currFaceI == extrudedI )
continue; continue;
if( pointExtruded_.contains(nextI, currFaceI) ) if( pointExtruded_.contains(nextI, currFaceI) )
{ {
if( otherFace != -1 ) if( otherFace != -1 )
@ -135,11 +135,11 @@ inline label extrudeLayer::addressingCalculator::faceSharingEdge
"(const label, const label) const" "(const label, const label) const"
) << "Expected only one such face" ) << "Expected only one such face"
<< abort(FatalError); << abort(FatalError);
otherFace = currFaceI; otherFace = currFaceI;
} }
} }
return otherFace; return otherFace;
} }
@ -151,11 +151,11 @@ inline void extrudeLayer::addressingCalculator::facesSharingEdge
) const ) const
{ {
edgeFaces.clear(); edgeFaces.clear();
forAllRow(pointExtruded_, start, pfI) forAllRow(pointExtruded_, start, pfI)
{ {
const label currFaceI = pointExtruded_(start, pfI); const label currFaceI = pointExtruded_(start, pfI);
if( pointExtruded_.contains(end, currFaceI) ) if( pointExtruded_.contains(end, currFaceI) )
edgeFaces.append(currFaceI); edgeFaces.append(currFaceI);
} }

View file

@ -39,9 +39,9 @@ Foam::DynList<T, staticSize>::DynList(Istream& is)
"template<class T, Foam::label staticSize>" "template<class T, Foam::label staticSize>"
"\nFoam::DynList<T, staticSize>::DynList(Istream& is)" "\nFoam::DynList<T, staticSize>::DynList(Istream& is)"
) << "Not implemented" << exit(FatalError); ) << "Not implemented" << exit(FatalError);
List<T> helper(is); List<T> helper(is);
nextFree_ = helper.size(); nextFree_ = helper.size();
UList<T>::swap(helper); UList<T>::swap(helper);
} }
@ -74,7 +74,7 @@ Foam::Istream& Foam::operator>>
"\nFoam::Istream& Foam::operator>>" "\nFoam::Istream& Foam::operator>>"
"(Foam::Istream& is, Foam::DynList<T, staticSize>& DL)" "(Foam::Istream& is, Foam::DynList<T, staticSize>& DL)"
) << "Not implemented" << exit(FatalError); ) << "Not implemented" << exit(FatalError);
is >> static_cast<List<T>&>(DL); is >> static_cast<List<T>&>(DL);
DL.nextFree_ = DL.List<T>::size(); DL.nextFree_ = DL.List<T>::size();

View file

@ -36,7 +36,7 @@ void Foam::FRWGraph<T, width>::checkIndex(const label i, const label j) const
<< " is not in range " << Foam::label(0) << " is not in range " << Foam::label(0)
<< " and " << nRows_ << abort(FatalError); << " and " << nRows_ << abort(FatalError);
} }
if( (j < 0) || (j >= width) ) if( (j < 0) || (j >= width) )
FatalErrorIn FatalErrorIn
( (
@ -163,7 +163,7 @@ inline bool Foam::FRWGraph<T,width>::contains
for(register label i=0;i<width;++i) for(register label i=0;i<width;++i)
if( data_[start+i] == e ) if( data_[start+i] == e )
return true; return true;
return false; return false;
} }
@ -178,7 +178,7 @@ inline Foam::label Foam::FRWGraph<T,width>::containsAtPosition
for(register label i=0;i<width;++i) for(register label i=0;i<width;++i)
if( data_[start+i] == e ) if( data_[start+i] == e )
return i; return i;
return -1; return -1;
} }
@ -193,7 +193,7 @@ inline const T& Foam::FRWGraph<T,width>::operator()
#ifdef FULLDEBUG #ifdef FULLDEBUG
checkIndex(i, j); checkIndex(i, j);
#endif #endif
return data_[i * width + j]; return data_[i * width + j];
} }
@ -206,7 +206,7 @@ inline T& Foam::FRWGraph<T,width>::operator()
#ifdef FULLDEBUG #ifdef FULLDEBUG
checkIndex(i, j); checkIndex(i, j);
#endif #endif
return data_[i * width + j]; return data_[i * width + j];
} }

View file

@ -81,7 +81,7 @@ IODynList<T, IndexType>::IODynList
readStream(typeName) >> *this; readStream(typeName) >> *this;
close(); close();
} }
DynList<T, IndexType>::operator=(list); DynList<T, IndexType>::operator=(list);
} }

View file

@ -81,7 +81,7 @@ IOLongList<T, Offset>::IOLongList
readStream(typeName) >> *this; readStream(typeName) >> *this;
close(); close();
} }
LongList<T, Offset>::operator=(list); LongList<T, Offset>::operator=(list);
} }

View file

@ -29,7 +29,7 @@ Description
every time it is resized every time it is resized
SourceFiles SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -53,24 +53,24 @@ class cellListPMG
// Private data // Private data
//- number of used elements //- number of used elements
label nElmts_; label nElmts_;
// Disallow bitwise assignment // Disallow bitwise assignment
void operator=(const cellListPMG&); void operator=(const cellListPMG&);
cellListPMG(const cellListPMG&); cellListPMG(const cellListPMG&);
// Disallow transfer from cellList // Disallow transfer from cellList
void transfer(cellList&); void transfer(cellList&);
public: public:
// Constructors // Constructors
//- null construct //- null construct
inline cellListPMG(); inline cellListPMG();
// Destructor // Destructor
inline ~cellListPMG(); inline ~cellListPMG();
// Member functions // Member functions
//- return the number of used elements //- return the number of used elements
inline label size() const; inline label size() const;
@ -83,15 +83,15 @@ public:
//- add a cell at the end of the list //- add a cell at the end of the list
inline void append(const cell&); inline void append(const cell&);
//- return an element with bound checking //- return an element with bound checking
inline cell& newElmt(const label); inline cell& newElmt(const label);
// Member operators // Member operators
inline void operator=(const cellList&); inline void operator=(const cellList&);
friend inline Ostream& operator<<(Ostream&, const cellListPMG&); friend inline Ostream& operator<<(Ostream&, const cellListPMG&);
friend inline Istream& operator>>(Istream&, cellListPMG&); friend inline Istream& operator>>(Istream&, cellListPMG&);
}; };

View file

@ -52,7 +52,7 @@ inline cellListPMG::~cellListPMG()
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline label cellListPMG::size() const inline label cellListPMG::size() const
{ {
return nElmts_; return nElmts_;
@ -68,7 +68,7 @@ inline void cellListPMG::setSize(const label nElmts)
cellList copy(label(1.5*nElmts)); cellList copy(label(1.5*nElmts));
for(label i=0;i<nElmts_;++i) for(label i=0;i<nElmts_;++i)
copy[i].transfer(this->operator[](i)); copy[i].transfer(this->operator[](i));
cellList::transfer(copy); cellList::transfer(copy);
} }
else else
@ -106,11 +106,11 @@ inline void cellListPMG::operator=(const cellList& cls)
forAll(cls, cI) forAll(cls, cI)
this->operator[](cI) = cls[cI]; this->operator[](cI) = cls[cI];
} }
inline Ostream& operator<<(Ostream& os, const cellListPMG& cls) inline Ostream& operator<<(Ostream& os, const cellListPMG& cls)
{ {
SubList<cell> c(cls, cls.nElmts_, 0); SubList<cell> c(cls, cls.nElmts_, 0);
os << c; os << c;
return os; return os;
} }
@ -120,7 +120,7 @@ inline Istream& operator>>(Istream& is, cellListPMG& cls)
cellList& cells = static_cast<cellList&>(cls); cellList& cells = static_cast<cellList&>(cls);
is >> cells; is >> cells;
cls.nElmts_ = cells.size(); cls.nElmts_ = cells.size();
return is; return is;
} }

View file

@ -69,7 +69,7 @@ inline faceListPMG::~faceListPMG()
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline label faceListPMG::size() const inline label faceListPMG::size() const
{ {
return nElmts_; return nElmts_;
@ -85,7 +85,7 @@ inline void faceListPMG::setSize(const label nElmts)
faceList copy(label(1.5*nElmts)); faceList copy(label(1.5*nElmts));
for(label i=0;i<nElmts_;++i) for(label i=0;i<nElmts_;++i)
copy[i].transfer(this->operator[](i)); copy[i].transfer(this->operator[](i));
faceList::transfer(copy); faceList::transfer(copy);
} }
else else
@ -128,11 +128,11 @@ inline void faceListPMG::operator=(const faceList& fcs)
forAll(fcs, fI) forAll(fcs, fI)
this->operator[](fI) = fcs[fI]; this->operator[](fI) = fcs[fI];
} }
inline Ostream& operator<<(Ostream& os, const faceListPMG& fcs) inline Ostream& operator<<(Ostream& os, const faceListPMG& fcs)
{ {
SubList<face> f(fcs, fcs.nElmts_, 0); SubList<face> f(fcs, fcs.nElmts_, 0);
os << f; os << f;
return os; return os;
} }
@ -142,7 +142,7 @@ inline Istream& operator>>(Istream& is, faceListPMG& fcs)
faceList& faces = static_cast<faceList&>(fcs); faceList& faces = static_cast<faceList&>(fcs);
is >> faces; is >> faces;
fcs.nElmts_ = faces.size(); fcs.nElmts_ = faces.size();
return is; return is;
} }

View file

@ -67,7 +67,7 @@ inline pointFieldPMG::~pointFieldPMG()
{} {}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline label pointFieldPMG::size() const inline label pointFieldPMG::size() const
{ {
return nElmts_; return nElmts_;
@ -121,11 +121,11 @@ inline void pointFieldPMG::operator=(const pointField& pts)
forAll(pts, pI) forAll(pts, pI)
this->operator[](pI) = pts[pI]; this->operator[](pI) = pts[pI];
} }
inline Ostream& operator<<(Ostream& os, const pointFieldPMG& pts) inline Ostream& operator<<(Ostream& os, const pointFieldPMG& pts)
{ {
SubList<point> p(pts, pts.nElmts_, 0); SubList<point> p(pts, pts.nElmts_, 0);
os << p; os << p;
return os; return os;
} }
@ -135,7 +135,7 @@ inline Istream& operator>>(Istream& is, pointFieldPMG& pts)
pointField& points = static_cast<pointField&>(pts); pointField& points = static_cast<pointField&>(pts);
is >> points; is >> points;
pts.nElmts_ = points.size(); pts.nElmts_ = points.size();
return is; return is;
} }

View file

@ -78,39 +78,39 @@ class LongList
// Private data // Private data
//- number of allocated elements //- number of allocated elements
label N_; label N_;
//- number of elements in the list //- number of elements in the list
label nextFree_; label nextFree_;
//- number of used blocks of data //- number of used blocks of data
label numBlocks_; label numBlocks_;
//- maximum number of blocks that can be allocated //- maximum number of blocks that can be allocated
//- without reallocating the list containing pointers //- without reallocating the list containing pointers
//- to the chunks of data //- to the chunks of data
label numAllocatedBlocks_; label numAllocatedBlocks_;
//- size of blocks is calculated by powers of 2 //- size of blocks is calculated by powers of 2
//- and therefore the access can be done using shift and mask //- and therefore the access can be done using shift and mask
label shift_; label shift_;
label mask_; label mask_;
//- array of pointers to the blocks of data, each of the size WIDTH //- array of pointers to the blocks of data, each of the size WIDTH
T** dataPtr_; T** dataPtr_;
// Private member functions // Private member functions
//- check index //- check index
void checkIndex(label const i) const; void checkIndex(label const i) const;
//- initialize width and mask //- initialize width and mask
void initializeParameters(); void initializeParameters();
//- Allocate memory for the list //- Allocate memory for the list
void allocateSize(const label); void allocateSize(const label);
//- delete all elements //- delete all elements
void clearOut(); void clearOut();
public: public:
// Constructors // Constructors
@ -137,9 +137,9 @@ public:
//- Size of the active part of the list. //- Size of the active part of the list.
inline label size() const; inline label size() const;
//- Return the binary size in number of characters of the UList //- Return the binary size in number of characters of the UList
// if the element is a primitive type // if the element is a primitive type
// i.e. contiguous<T>() == true // i.e. contiguous<T>() == true
inline label byteSize() const; inline label byteSize() const;
@ -154,7 +154,7 @@ public:
//- Shrink the list to the number of elements used //- Shrink the list to the number of elements used
inline LongList<T, Offset>& shrink(); inline LongList<T, Offset>& shrink();
//- transfer the list from another one without allocating it //- transfer the list from another one without allocating it
inline void transfer(LongList<T, Offset>&); inline void transfer(LongList<T, Offset>&);
@ -163,11 +163,11 @@ public:
//- Append an element at the end of the list //- Append an element at the end of the list
inline void append(const T& e); inline void append(const T& e);
//- Append an element at the end of the list if it is not yet //- Append an element at the end of the list if it is not yet
//- present in the list (takes linear time) //- present in the list (takes linear time)
inline void appendIfNotIn(const T& e); inline void appendIfNotIn(const T& e);
//- check if the element is in the list (takes linear time) //- check if the element is in the list (takes linear time)
inline bool contains(const T& e) const; inline bool contains(const T& e) const;
inline label containsAtPosition(const T& e) const; inline label containsAtPosition(const T& e) const;
@ -175,7 +175,7 @@ public:
//- Return and remove the element //- Return and remove the element
inline T remove(const label i); inline T remove(const label i);
inline T removeLastElement(); inline T removeLastElement();
//- get and set operators //- get and set operators
inline const T& operator[](const label i) const; inline const T& operator[](const label i) const;
inline T& operator[](const label i); inline T& operator[](const label i);
@ -183,14 +183,14 @@ public:
//- Return non-const access to an element, //- Return non-const access to an element,
// resizing the list if necessary // resizing the list if necessary
inline T& operator()(const label); inline T& operator()(const label);
//- return a non-const access to an element, //- return a non-const access to an element,
// resize the list if necessary // resize the list if necessary
inline T& newElmt(const label); inline T& newElmt(const label);
//- Assignment of all entries to the given value //- Assignment of all entries to the given value
inline void operator=(const T&); inline void operator=(const T&);
//- Assignment operator //- Assignment operator
inline void operator=(const LongList<T, Offset>&); inline void operator=(const LongList<T, Offset>&);
@ -198,7 +198,7 @@ public:
// IOstream operators // IOstream operators
//- Read from stream and append to the current content //- Read from stream and append to the current content
void appendFromStream(Istream&); void appendFromStream(Istream&);
//- Write as a dictionary entry. //- Write as a dictionary entry.
void writeEntry(Ostream& os) const; void writeEntry(Ostream& os) const;

View file

@ -44,13 +44,13 @@ void Foam::LongList<T, Offset>::initializeParameters()
{ {
unsigned int t = sizeof(T); unsigned int t = sizeof(T);
label it(0); label it(0);
while( t > 1 ) while( t > 1 )
{ {
t >>= 1; t >>= 1;
++it; ++it;
} }
shift_ = Foam::max(10, Offset - it); shift_ = Foam::max(10, Offset - it);
mask_ = 1<<shift_; mask_ = 1<<shift_;
mask_ -= 1; mask_ -= 1;
@ -64,10 +64,10 @@ inline void Foam::LongList<T, Offset>::allocateSize(const label s)
clearOut(); clearOut();
return; return;
} }
const label numblock1 = ((s-1)>>shift_) + 1; const label numblock1 = ((s-1)>>shift_) + 1;
const label blockSize = 1<<shift_; const label blockSize = 1<<shift_;
if( numblock1 < numBlocks_ ) if( numblock1 < numBlocks_ )
{ {
for(register label i=numblock1;i<numBlocks_;++i) for(register label i=numblock1;i<numBlocks_;++i)
@ -81,20 +81,20 @@ inline void Foam::LongList<T, Offset>::allocateSize(const label s)
{ {
numAllocatedBlocks_ += 64; numAllocatedBlocks_ += 64;
} while( numblock1 > numAllocatedBlocks_ ); } while( numblock1 > numAllocatedBlocks_ );
T** dataptr1 = new T*[numAllocatedBlocks_]; T** dataptr1 = new T*[numAllocatedBlocks_];
for(register label i=0;i<numBlocks_;++i) for(register label i=0;i<numBlocks_;++i)
dataptr1[i] = dataPtr_[i]; dataptr1[i] = dataPtr_[i];
if( dataPtr_ ) if( dataPtr_ )
delete [] dataPtr_; delete [] dataPtr_;
dataPtr_ = dataptr1; dataPtr_ = dataptr1;
} }
for(register label i=numBlocks_;i<numblock1;++i) for(register label i=numBlocks_;i<numblock1;++i)
dataPtr_[i] = new T[blockSize]; dataPtr_[i] = new T[blockSize];
} }
numBlocks_ = numblock1; numBlocks_ = numblock1;
N_ = numBlocks_ * blockSize; N_ = numBlocks_ * blockSize;
} }
@ -104,13 +104,13 @@ void Foam::LongList<T, Offset>::clearOut()
{ {
for(register label i=0;i<numBlocks_;++i) for(register label i=0;i<numBlocks_;++i)
delete [] dataPtr_[i]; delete [] dataPtr_[i];
if( dataPtr_ ) if( dataPtr_ )
{ {
delete [] dataPtr_; delete [] dataPtr_;
dataPtr_ = NULL; dataPtr_ = NULL;
} }
N_ = 0; N_ = 0;
numBlocks_ = 0; numBlocks_ = 0;
numAllocatedBlocks_ = 0; numAllocatedBlocks_ = 0;
@ -243,7 +243,7 @@ inline void Foam::LongList<T, Offset>::transfer(LongList<T, Offset>& ol)
numAllocatedBlocks_ = ol.numAllocatedBlocks_; numAllocatedBlocks_ = ol.numAllocatedBlocks_;
shift_ = ol.shift_; shift_ = ol.shift_;
mask_ = ol.mask_; mask_ = ol.mask_;
ol.dataPtr_ = NULL; ol.dataPtr_ = NULL;
ol.N_ = 0; ol.N_ = 0;
ol.nextFree_ = 0; ol.nextFree_ = 0;
@ -259,7 +259,7 @@ inline void Foam::LongList<T, Offset>::append(const T& e)
{ {
allocateSize(nextFree_+1); allocateSize(nextFree_+1);
} }
operator[](nextFree_++) = e; operator[](nextFree_++) = e;
} }
@ -276,7 +276,7 @@ inline bool Foam::LongList<T, Offset>::contains(const T& e) const
for(register label i=0;i<nextFree_;++i) for(register label i=0;i<nextFree_;++i)
if( (*this)[i] == e ) if( (*this)[i] == e )
return true; return true;
return false; return false;
} }
@ -289,7 +289,7 @@ inline Foam::label Foam::LongList<T, Offset>::containsAtPosition
for(register label i=0;i<nextFree_;++i) for(register label i=0;i<nextFree_;++i)
if( (*this)[i] == e ) if( (*this)[i] == e )
return i; return i;
return -1; return -1;
} }
@ -303,7 +303,7 @@ inline T Foam::LongList<T, Offset>::remove(const label i)
"void Foam::LongList<T, Offset>::remove()" "void Foam::LongList<T, Offset>::remove()"
) << "List is empty" << abort(FatalError); ) << "List is empty" << abort(FatalError);
} }
T el = operator[](i); T el = operator[](i);
operator[](i) = operator[](nextFree_-1); operator[](i) = operator[](nextFree_-1);
--nextFree_; --nextFree_;
@ -320,7 +320,7 @@ inline T Foam::LongList<T, Offset>::removeLastElement()
"void Foam::LongList<T, Offset>::remove()" "void Foam::LongList<T, Offset>::remove()"
) << "List is empty" << abort(FatalError); ) << "List is empty" << abort(FatalError);
} }
T lastEl = operator[](nextFree_-1); T lastEl = operator[](nextFree_-1);
--nextFree_; --nextFree_;
return lastEl; return lastEl;
@ -335,7 +335,7 @@ inline const T& Foam::LongList<T, Offset>::operator[](const label i) const
#ifdef FULLDEBUG #ifdef FULLDEBUG
checkIndex(i); checkIndex(i);
#endif #endif
return dataPtr_[i>>shift_][i&mask_]; return dataPtr_[i>>shift_][i&mask_];
} }
@ -345,7 +345,7 @@ inline T& Foam::LongList<T, Offset>::operator[](const label i)
#ifdef FULLDEBUG #ifdef FULLDEBUG
checkIndex(i); checkIndex(i);
#endif #endif
return dataPtr_[i>>shift_][i&mask_]; return dataPtr_[i>>shift_][i&mask_];
} }

View file

@ -36,20 +36,20 @@ Foam::Ostream& Foam::operator<<
) )
{ {
os << DL.size() << nl << token::BEGIN_LIST; os << DL.size() << nl << token::BEGIN_LIST;
for(register label i=0;i<DL.size();++i) for(register label i=0;i<DL.size();++i)
{ {
os << nl << DL.sizeOfRow(i) << token::BEGIN_LIST; os << nl << DL.sizeOfRow(i) << token::BEGIN_LIST;
for(label j=0;j<DL.sizeOfRow(i);++j) for(label j=0;j<DL.sizeOfRow(i);++j)
{ {
if( j > 0 ) os << token::SPACE; if( j > 0 ) os << token::SPACE;
os << DL(i, j); os << DL(i, j);
} }
os << token::END_LIST; os << token::END_LIST;
} }
os << nl << token::END_LIST; os << nl << token::END_LIST;
return os; return os;
} }
@ -90,14 +90,14 @@ void Foam::VRWGraph::optimizeMemoryUsage()
{ {
newPosForNode[elI] = -1; newPosForNode[elI] = -1;
} }
//- create new data //- create new data
for(label elI=0;elI<nElements;++elI) for(label elI=0;elI<nElements;++elI)
if( (newPosForNode[elI] != -1) && (newPosForNode[elI] < elI) ) if( (newPosForNode[elI] != -1) && (newPosForNode[elI] < elI) )
data_[newPosForNode[elI]] = data_[elI]; data_[newPosForNode[elI]] = data_[elI];
data_.setSize(pos); data_.setSize(pos);
//- renumber rows //- renumber rows
nElements = rows_.size(); nElements = rows_.size();
for(label rowI=0;rowI<nElements;++rowI) for(label rowI=0;rowI<nElements;++rowI)

View file

@ -47,32 +47,32 @@ SourceFiles
namespace Foam namespace Foam
{ {
class VRWGraphModifier; class VRWGraphModifier;
class rowElement class rowElement
{ {
// Private data // Private data
label start_; label start_;
label size_; label size_;
public: public:
inline rowElement() inline rowElement()
: :
start_(), start_(),
size_() size_()
{} {}
inline rowElement(const label i, const label j) inline rowElement(const label i, const label j)
: :
start_(i), start_(i),
size_(j) size_(j)
{} {}
inline ~rowElement() inline ~rowElement()
{} {}
inline label start() const inline label start() const
{ {
return start_; return start_;
@ -81,7 +81,7 @@ class rowElement
{ {
return start_; return start_;
} }
inline label size() const inline label size() const
{ {
return size_; return size_;
@ -101,7 +101,7 @@ class VRWGraph
// Private data // Private data
//- list containing the data //- list containing the data
labelLongList data_; labelLongList data_;
//- number of rows //- number of rows
LongList<rowElement> rows_; LongList<rowElement> rows_;
@ -117,9 +117,9 @@ class VRWGraph
FREEENTRY=-11, FREEENTRY=-11,
FREESTART=-12 FREESTART=-12
}; };
public: public:
// Friend classes // Friend classes
friend class VRWGraphSMPModifier; friend class VRWGraphSMPModifier;
@ -131,7 +131,7 @@ public:
//- Construct given number of rows //- Construct given number of rows
explicit inline VRWGraph(const label size); explicit inline VRWGraph(const label size);
//- Construct given number of rows and row size //- Construct given number of rows and row size
explicit inline VRWGraph explicit inline VRWGraph
( (
@ -160,7 +160,7 @@ public:
//- Returns the number of rows //- Returns the number of rows
inline label size() const; inline label size() const;
//- Returns the number of elements in the given row //- Returns the number of elements in the given row
inline label sizeOfRow(const label rowI) const; inline label sizeOfRow(const label rowI) const;
@ -168,7 +168,7 @@ public:
//- Reset the number of rows //- Reset the number of rows
inline void setSize(const label); inline void setSize(const label);
//- Reset the number of rows. The second argument specifies //- Reset the number of rows. The second argument specifies
//- the reserved column width //- the reserved column width
inline void setSizeAndColumnWidth inline void setSizeAndColumnWidth
@ -176,11 +176,11 @@ public:
const label newNumRows, const label newNumRows,
const label rcWidth const label rcWidth
); );
//- Set the number of rows and the size of each row //- Set the number of rows and the size of each row
template<class ListType> template<class ListType>
inline void setSizeAndRowSize(const ListType&); inline void setSizeAndRowSize(const ListType&);
//- Reset the size of the given row //- Reset the size of the given row
inline void setRowSize(const label rowI, const label newSize); inline void setRowSize(const label rowI, const label newSize);
@ -192,21 +192,21 @@ public:
//- Append a list as a row at the end of the graph //- Append a list as a row at the end of the graph
template<class ListType> template<class ListType>
inline void appendList(const ListType& l); inline void appendList(const ListType& l);
//- Append an element to the given row //- Append an element to the given row
inline void append(const label rowI, const label); inline void append(const label rowI, const label);
//- Append an element to the given row if it does not exist there //- Append an element to the given row if it does not exist there
inline void appendIfNotIn(const label rowI, const label); inline void appendIfNotIn(const label rowI, const label);
//- Set row with the list //- Set row with the list
template<class ListType> template<class ListType>
inline void setRow(const label rowI, const ListType& l); inline void setRow(const label rowI, const ListType& l);
//- merge graphs with the identical number of rows //- merge graphs with the identical number of rows
//- into a single one. Use for SMP parallelisation //- into a single one. Use for SMP parallelisation
inline void mergeGraphs(const List<VRWGraph>& graphParts); inline void mergeGraphs(const List<VRWGraph>& graphParts);
//- set the graph to the reverse of the original graph. //- set the graph to the reverse of the original graph.
//- the rows of such graph store the rows which contain the elements //- the rows of such graph store the rows which contain the elements
//- of the original graph //- of the original graph
@ -216,33 +216,33 @@ public:
const label nRows, const label nRows,
const GraphType& origGraph const GraphType& origGraph
); );
template<class GraphType> template<class GraphType>
inline void reverseAddressing(const GraphType& origGraph); inline void reverseAddressing(const GraphType& origGraph);
inline void reverseAddressing inline void reverseAddressing
( (
const label nRows, const label nRows,
const VRWGraph& origGraph const VRWGraph& origGraph
); );
inline void reverseAddressing(const VRWGraph& origGraph); inline void reverseAddressing(const VRWGraph& origGraph);
//- optimize memory usage //- optimize memory usage
// this should be used once the graph will not be resized any more // this should be used once the graph will not be resized any more
void optimizeMemoryUsage(); void optimizeMemoryUsage();
//- check if the element is in the given row (takes linear time) //- check if the element is in the given row (takes linear time)
inline bool contains(const label rowI, const label e) const; inline bool contains(const label rowI, const label e) const;
inline label containsAtPosition(const label rowI, const label e) const; inline label containsAtPosition(const label rowI, const label e) const;
//- get and set operators //- get and set operators
inline label operator()(const label i, const label j) const; inline label operator()(const label i, const label j) const;
inline label& operator()(const label i, const label j); inline label& operator()(const label i, const label j);
inline constRow operator[](const label i) const; inline constRow operator[](const label i) const;
inline row operator[](const label i); inline row operator[](const label i);
//- Assignment operator //- Assignment operator
inline void operator=(const VRWGraph&); inline void operator=(const VRWGraph&);

View file

@ -35,7 +35,7 @@ inline void Foam::VRWGraph::checkIndex(const label i, const label j) const
<< " is not in range " << Foam::label(0) << " is not in range " << Foam::label(0)
<< " and " << rows_.size() << abort(FatalError); << " and " << rows_.size() << abort(FatalError);
} }
if( (j < 0) || (j >= rows_[i].size()) ) if( (j < 0) || (j >= rows_[i].size()) )
FatalErrorIn FatalErrorIn
( (
@ -137,7 +137,7 @@ inline void Foam::VRWGraph::setSize(const label size)
if( size > rows_.size() ) if( size > rows_.size() )
{ {
rowElement rowInfo(INVALIDROW, NONE); rowElement rowInfo(INVALIDROW, NONE);
for(label i=rows_.size();i<size;++i) for(label i=rows_.size();i<size;++i)
rows_.append(rowInfo); rows_.append(rowInfo);
} }
@ -163,16 +163,16 @@ void Foam::VRWGraph::setSizeAndColumnWidth
data_.setSize(newNumRows * rcWidth); data_.setSize(newNumRows * rcWidth);
data_ = FREEENTRY; data_ = FREEENTRY;
rows_.setSize(newNumRows); rows_.setSize(newNumRows);
label start(0); label start(0);
for(label i=0;i<newNumRows;++i) for(label i=0;i<newNumRows;++i)
{ {
rows_[i].start() = start; rows_[i].start() = start;
rows_[i].size() = 0; rows_[i].size() = 0;
data_[start] = FREESTART; data_[start] = FREESTART;
start += rcWidth; start += rcWidth;
} }
} }
@ -183,12 +183,12 @@ inline void Foam::VRWGraph::setSizeAndRowSize(const ListType& l)
//- set the size of graph rows //- set the size of graph rows
const label nRows = l.size(); const label nRows = l.size();
rows_.setSize(nRows); rows_.setSize(nRows);
label start(0); label start(0);
for(label rowI=0;rowI<nRows;++rowI) for(label rowI=0;rowI<nRows;++rowI)
{ {
rows_[rowI].size() = l[rowI]; rows_[rowI].size() = l[rowI];
if( rows_[rowI].size() != NONE ) if( rows_[rowI].size() != NONE )
{ {
rows_[rowI].start() = start; rows_[rowI].start() = start;
@ -197,10 +197,10 @@ inline void Foam::VRWGraph::setSizeAndRowSize(const ListType& l)
{ {
rows_[rowI].start() = INVALIDROW; rows_[rowI].start() = INVALIDROW;
} }
start += rows_[rowI].size(); start += rows_[rowI].size();
} }
data_.setSize(start); data_.setSize(start);
} }
@ -216,7 +216,7 @@ inline void Foam::VRWGraph::setRowSize(const label rowI, const label newSize)
<< " is not in range " << Foam::label(0) << " is not in range " << Foam::label(0)
<< " and " << rows_.size() << abort(FatalError); << " and " << rows_.size() << abort(FatalError);
# endif # endif
const label start = rows_[rowI].start(); const label start = rows_[rowI].start();
if( start == INVALIDROW ) if( start == INVALIDROW )
{ {
@ -232,7 +232,7 @@ inline void Foam::VRWGraph::setRowSize(const label rowI, const label newSize)
{ {
//- check if there is some unused space after the last element //- check if there is some unused space after the last element
bool foundUnused(true); bool foundUnused(true);
for(label i=rows_[rowI].size();i<newSize;++i) for(label i=rows_[rowI].size();i<newSize;++i)
{ {
const label j = start + i; const label j = start + i;
@ -246,7 +246,7 @@ inline void Foam::VRWGraph::setRowSize(const label rowI, const label newSize)
break; break;
} }
} }
if( foundUnused ) if( foundUnused )
{ {
//- row can be extended without copying //- row can be extended without copying
@ -265,7 +265,7 @@ inline void Foam::VRWGraph::setRowSize(const label rowI, const label newSize)
for(label i=rows_[rowI].size();i<newSize;++i) for(label i=rows_[rowI].size();i<newSize;++i)
data_.append(NONE); data_.append(NONE);
} }
rows_[rowI].size() = newSize; rows_[rowI].size() = newSize;
} }
else if( newSize < rows_[rowI].size() ) else if( newSize < rows_[rowI].size() )
@ -295,7 +295,7 @@ inline void Foam::VRWGraph::appendList
rows_.append(rowElement(INVALIDROW, 0)); rows_.append(rowElement(INVALIDROW, 0));
return; return;
} }
rowElement rowInfo(data_.size(), l.size()); rowElement rowInfo(data_.size(), l.size());
const label size = l.size(); const label size = l.size();
for(label elI=0;elI<size;++elI) for(label elI=0;elI<size;++elI)
@ -318,7 +318,7 @@ inline void Foam::VRWGraph::append(const label rowI, const label el)
const label oldStart = re.start(); const label oldStart = re.start();
const label oldSize = re.size(); const label oldSize = re.size();
++re.size(); ++re.size();
if( oldStart + oldSize < data_.size() ) if( oldStart + oldSize < data_.size() )
{ {
if( if(
@ -378,7 +378,7 @@ inline void Foam::VRWGraph::mergeGraphs(const List<VRWGraph>& graphParts)
"inline void Foam::VRWGraph::mergeGraphs(const List<VRWGraph>&)" "inline void Foam::VRWGraph::mergeGraphs(const List<VRWGraph>&)"
) << "Cannot merge graphs" << abort(FatalError); ) << "Cannot merge graphs" << abort(FatalError);
} }
//- find the number of elements in each row //- find the number of elements in each row
labelLongList nElmtsInRow(nRows); labelLongList nElmtsInRow(nRows);
for(label rowI=0;rowI<nRows;++rowI) for(label rowI=0;rowI<nRows;++rowI)
@ -386,12 +386,12 @@ inline void Foam::VRWGraph::mergeGraphs(const List<VRWGraph>& graphParts)
label sum(0); label sum(0);
for(label i=0;i<nGraphs;++i) for(label i=0;i<nGraphs;++i)
sum += graphParts[i].sizeOfRow(rowI); sum += graphParts[i].sizeOfRow(rowI);
nElmtsInRow[rowI] = sum; nElmtsInRow[rowI] = sum;
} }
setSizeAndRowSize(nElmtsInRow); setSizeAndRowSize(nElmtsInRow);
//- Finally, assemble the merged graph //- Finally, assemble the merged graph
for(label rowI=0;rowI<nRows;++rowI) for(label rowI=0;rowI<nRows;++rowI)
{ {
@ -413,26 +413,26 @@ inline void Foam::VRWGraph::reverseAddressing
{ {
const label origSize = origGraph.size(); const label origSize = origGraph.size();
labelLongList nElmtsInRow(nRows); labelLongList nElmtsInRow(nRows);
for(label rowI=0;rowI<nRows;++rowI) for(label rowI=0;rowI<nRows;++rowI)
nElmtsInRow[rowI] = 0; nElmtsInRow[rowI] = 0;
for(label rowI=0;rowI<origSize;++rowI) for(label rowI=0;rowI<origSize;++rowI)
{ {
const label rowSize = origGraph[rowI].size(); const label rowSize = origGraph[rowI].size();
for(label i=0;i<rowSize;++i) for(label i=0;i<rowSize;++i)
++nElmtsInRow[origGraph[rowI][i]]; ++nElmtsInRow[origGraph[rowI][i]];
} }
setSizeAndRowSize(nElmtsInRow); setSizeAndRowSize(nElmtsInRow);
nElmtsInRow = 0; nElmtsInRow = 0;
//- finally fill in the data //- finally fill in the data
for(label rowI=0;rowI<origSize;++rowI) for(label rowI=0;rowI<origSize;++rowI)
{ {
const label rowSize = origGraph[rowI].size(); const label rowSize = origGraph[rowI].size();
for(label i=0;i<rowSize;++i) for(label i=0;i<rowSize;++i)
{ {
const label el = origGraph[rowI][i]; const label el = origGraph[rowI][i];
@ -446,14 +446,14 @@ inline void Foam::VRWGraph::reverseAddressing(const GraphType& origGraph)
{ {
const label size = origGraph.size(); const label size = origGraph.size();
label maxValue(-1); label maxValue(-1);
for(label rowI=0;rowI<size;++rowI) for(label rowI=0;rowI<size;++rowI)
{ {
const label rowSize = origGraph[rowI].size(); const label rowSize = origGraph[rowI].size();
for(label i=0;i<rowSize;++i) for(label i=0;i<rowSize;++i)
maxValue = Foam::max(maxValue, origGraph[rowI][i]); maxValue = Foam::max(maxValue, origGraph[rowI][i]);
} }
++maxValue; ++maxValue;
reverseAddressing(maxValue, origGraph); reverseAddressing(maxValue, origGraph);
} }
@ -466,26 +466,26 @@ inline void Foam::VRWGraph::reverseAddressing
{ {
const label origSize = origGraph.size(); const label origSize = origGraph.size();
labelLongList nElmtsInRow(nRows); labelLongList nElmtsInRow(nRows);
for(label rowI=0;rowI<nRows;++rowI) for(label rowI=0;rowI<nRows;++rowI)
nElmtsInRow[rowI] = 0; nElmtsInRow[rowI] = 0;
for(label rowI=0;rowI<origSize;++rowI) for(label rowI=0;rowI<origSize;++rowI)
{ {
const label rowSize = origGraph.sizeOfRow(rowI); const label rowSize = origGraph.sizeOfRow(rowI);
for(label i=0;i<rowSize;++i) for(label i=0;i<rowSize;++i)
++nElmtsInRow[origGraph(rowI, i)]; ++nElmtsInRow[origGraph(rowI, i)];
} }
setSizeAndRowSize(nElmtsInRow); setSizeAndRowSize(nElmtsInRow);
nElmtsInRow = 0; nElmtsInRow = 0;
//- finally fill in the data //- finally fill in the data
for(label rowI=0;rowI<origSize;++rowI) for(label rowI=0;rowI<origSize;++rowI)
{ {
const label rowSize = origGraph.sizeOfRow(rowI); const label rowSize = origGraph.sizeOfRow(rowI);
for(label i=0;i<rowSize;++i) for(label i=0;i<rowSize;++i)
{ {
const label el = origGraph(rowI, i); const label el = origGraph(rowI, i);
@ -498,14 +498,14 @@ inline void Foam::VRWGraph::reverseAddressing(const VRWGraph& origGraph)
{ {
const label size = origGraph.size(); const label size = origGraph.size();
label maxValue(-1); label maxValue(-1);
for(label rowI=0;rowI<size;++rowI) for(label rowI=0;rowI<size;++rowI)
{ {
const label rowSize = origGraph.sizeOfRow(rowI); const label rowSize = origGraph.sizeOfRow(rowI);
for(label i=0;i<rowSize;++i) for(label i=0;i<rowSize;++i)
maxValue = Foam::max(maxValue, origGraph(rowI, i)); maxValue = Foam::max(maxValue, origGraph(rowI, i));
} }
++maxValue; ++maxValue;
reverseAddressing(maxValue, origGraph); reverseAddressing(maxValue, origGraph);
} }
@ -520,11 +520,11 @@ inline bool Foam::VRWGraph::contains
if( start == INVALIDROW ) if( start == INVALIDROW )
return false; return false;
const label size = rows_[rowI].size(); const label size = rows_[rowI].size();
for(register label i=0;i<size;++i) for(register label i=0;i<size;++i)
if( data_[start+i] == e ) if( data_[start+i] == e )
return true; return true;
return false; return false;
} }
@ -537,12 +537,12 @@ inline Foam::label Foam::VRWGraph::containsAtPosition
const label start = rows_[rowI].start(); const label start = rows_[rowI].start();
if( start == INVALIDROW ) if( start == INVALIDROW )
return -1; return -1;
const label size = rows_[rowI].size(); const label size = rows_[rowI].size();
for(register label i=0;i<size;++i) for(register label i=0;i<size;++i)
if( data_[start+i] == e ) if( data_[start+i] == e )
return i; return i;
return -1; return -1;
} }
@ -557,7 +557,7 @@ inline Foam::label Foam::VRWGraph::operator()
#ifdef FULLDEBUG #ifdef FULLDEBUG
checkIndex(i, j); checkIndex(i, j);
#endif #endif
return data_[rows_[i].start() + j]; return data_[rows_[i].start() + j];
} }
@ -570,7 +570,7 @@ inline Foam::label& Foam::VRWGraph::operator()
#ifdef FULLDEBUG #ifdef FULLDEBUG
checkIndex(i, j); checkIndex(i, j);
#endif #endif
return data_[rows_[i].start() + j]; return data_[rows_[i].start() + j];
} }

View file

@ -27,7 +27,7 @@ Class
Description Description
This class is a modifier for VRWGraph which allows for multi-threaded This class is a modifier for VRWGraph which allows for multi-threaded
execution of most time-consuimg functions execution of most time-consuimg functions
SourceFiles SourceFiles
VRWGraphSMPModifier.H VRWGraphSMPModifier.H
VRWGraphSMPModifier.C VRWGraphSMPModifier.C
@ -64,7 +64,7 @@ class VRWGraphSMPModifier
//- Disallow bitwise assignment //- Disallow bitwise assignment
void operator=(const VRWGraphSMPModifier&); void operator=(const VRWGraphSMPModifier&);
public: public:
// Constructor // Constructor
@ -81,27 +81,27 @@ public:
//- set the size and row sizes //- set the size and row sizes
template<class ListType> template<class ListType>
void setSizeAndRowSize(const ListType&); void setSizeAndRowSize(const ListType&);
//- merge graphs with the identical number of rows //- merge graphs with the identical number of rows
//- into a single one. Use for SMP parallelisation //- into a single one. Use for SMP parallelisation
void mergeGraphs(const List<VRWGraph>& graphParts); void mergeGraphs(const List<VRWGraph>& graphParts);
//- set the graph to the reverse of the original graph. //- set the graph to the reverse of the original graph.
//- the rows of such graph store the rows which contain the elements //- the rows of such graph store the rows which contain the elements
//- of the original graph //- of the original graph
template<class GraphType> template<class GraphType>
void reverseAddressing(const GraphType& origGraph); void reverseAddressing(const GraphType& origGraph);
void reverseAddressing(const VRWGraph& origGraph); void reverseAddressing(const VRWGraph& origGraph);
//- set the graph to the reverse of the original graph and mapped //- set the graph to the reverse of the original graph and mapped
//- to another space. //- to another space.
template<class ListType, class GraphType> template<class ListType, class GraphType>
void reverseAddressing(const ListType&, const GraphType&); void reverseAddressing(const ListType&, const GraphType&);
template<class ListType> template<class ListType>
void reverseAddressing(const ListType&, const VRWGraph&); void reverseAddressing(const ListType&, const VRWGraph&);
//- optimize memory usage //- optimize memory usage
// this should be used once the graph will not be resized any more // this should be used once the graph will not be resized any more
void optimizeMemoryUsage(); void optimizeMemoryUsage();

View file

@ -36,12 +36,12 @@ Foam::Ostream& Foam::operator<<
) )
{ {
os << DL.size() << nl << token::BEGIN_LIST; os << DL.size() << nl << token::BEGIN_LIST;
for(register label i=0;i<DL.size();++i) for(register label i=0;i<DL.size();++i)
{ {
os << nl << DL[i]; os << nl << DL[i];
} }
os << nl << token::END_LIST; os << nl << token::END_LIST;
return os; return os;
} }

View file

@ -51,11 +51,11 @@ namespace Foam
class VRWGraphList class VRWGraphList
{ {
// Private data // Private data
//- graph containing the data //- graph containing the data
VRWGraph data_; VRWGraph data_;
//- number of rows //- number of rows
LongList<rowElement> rows_; LongList<rowElement> rows_;
@ -67,7 +67,7 @@ class VRWGraphList
const label j, const label j,
const label k const label k
) const; ) const;
public: public:
// Constructors // Constructors
@ -88,10 +88,10 @@ public:
//- Returns the number of graphs //- Returns the number of graphs
inline label size() const; inline label size() const;
//- Returns the number of rows in the graph at that position //- Returns the number of rows in the graph at that position
inline label sizeOfGraph(const label posI) const; inline label sizeOfGraph(const label posI) const;
//- Return the number of element in the row at the given position //- Return the number of element in the row at the given position
inline label sizeOfRow(const label posI, const label rowI) const; inline label sizeOfRow(const label posI, const label rowI) const;
@ -103,7 +103,7 @@ public:
//- Append a graph at the end of the graphList //- Append a graph at the end of the graphList
template<class GraphType> template<class GraphType>
inline void appendGraph(const GraphType& l); inline void appendGraph(const GraphType& l);
//- get and set operators //- get and set operators
inline label operator() inline label operator()
( (
@ -111,11 +111,11 @@ public:
const label j, const label j,
const label k const label k
) const; ) const;
inline label& operator()(const label i, const label j, const label k); inline label& operator()(const label i, const label j, const label k);
inline const subGraph<const VRWGraph> operator[](const label i) const; inline const subGraph<const VRWGraph> operator[](const label i) const;
//- Assignment operator //- Assignment operator
inline void operator=(const VRWGraphList&); inline void operator=(const VRWGraphList&);

View file

@ -25,7 +25,7 @@ License
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline void Foam::VRWGraphList::checkIndex inline void Foam::VRWGraphList::checkIndex
@ -45,7 +45,7 @@ inline void Foam::VRWGraphList::checkIndex
<< " is not in range " << Foam::label(0) << " is not in range " << Foam::label(0)
<< " and " << rows_.size() << abort(FatalError); << " and " << rows_.size() << abort(FatalError);
} }
if( (j < 0) || (j >= rows_[i].size()) ) if( (j < 0) || (j >= rows_[i].size()) )
FatalErrorIn FatalErrorIn
( (
@ -54,7 +54,7 @@ inline void Foam::VRWGraphList::checkIndex
) << "Row index " << Foam::label(j) ) << "Row index " << Foam::label(j)
<< " is not in range " << Foam::label(0) << " is not in range " << Foam::label(0)
<< " and " << rows_[i].size() << abort(FatalError); << " and " << rows_[i].size() << abort(FatalError);
if( (k < 0) || (k >= data_.sizeOfRow(rows_[i].start()+j)) ) if( (k < 0) || (k >= data_.sizeOfRow(rows_[i].start()+j)) )
FatalErrorIn FatalErrorIn
( (
@ -125,10 +125,10 @@ inline void Foam::VRWGraphList::appendGraph
) )
{ {
rowElement re(data_.size(), l.size()); rowElement re(data_.size(), l.size());
for(label i=0;i<l.size();++i) for(label i=0;i<l.size();++i)
data_.appendList(l[i]); data_.appendList(l[i]);
rows_.append(re); rows_.append(re);
} }
@ -144,7 +144,7 @@ inline Foam::label Foam::VRWGraphList::operator()
#ifdef FULLDEBUG #ifdef FULLDEBUG
checkIndex(i, j, k); checkIndex(i, j, k);
#endif #endif
return data_(rows_[i].start() + j, k); return data_(rows_[i].start() + j, k);
} }
@ -157,7 +157,7 @@ inline Foam::label& Foam::VRWGraphList::operator()
#ifdef FULLDEBUG #ifdef FULLDEBUG
checkIndex(i, j, k); checkIndex(i, j, k);
#endif #endif
return data_(rows_[i].start() + j, k); return data_(rows_[i].start() + j, k);
} }

View file

@ -43,7 +43,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
class VRWGraph; class VRWGraph;
template<class graphType> class graphRow; template<class graphType> class graphRow;
@ -60,14 +60,14 @@ class graphRow
// Private data // Private data
//- reference to the graph //- reference to the graph
graphType& data_; graphType& data_;
//- row number //- row number
const label rowI_; const label rowI_;
// Private member functions // Private member functions
//- check index //- check index
inline void checkIndex(const label i) const; inline void checkIndex(const label i) const;
public: public:
// Constructors // Constructors
@ -94,21 +94,21 @@ public:
inline void clear(); inline void clear();
// Member Operators // Member Operators
//- Append an element to the given row //- Append an element to the given row
inline void append(const label); inline void append(const label);
//- Append an element to the given row if it does not exist there //- Append an element to the given row if it does not exist there
inline void appendIfNotIn(const label); inline void appendIfNotIn(const label);
//- check if the element is in the given row (takes linear time) //- check if the element is in the given row (takes linear time)
inline bool contains(const label e) const; inline bool contains(const label e) const;
inline label containsAtPosition(const label e) const; inline label containsAtPosition(const label e) const;
//- set and get operators //- set and get operators
inline label operator[](const label) const; inline label operator[](const label) const;
inline label& operator[](const label); inline label& operator[](const label);
//- Assignment operator //- Assignment operator
inline void operator=(const graphRow<graphType>&); inline void operator=(const graphRow<graphType>&);
template<class listType> template<class listType>

View file

@ -160,7 +160,7 @@ inline Foam::Ostream& operator<<
for(Foam::label i=0;i<r.size();++i) for(Foam::label i=0;i<r.size();++i)
os << r[i] << " "; os << r[i] << " ";
os << ")"; os << ")";
return os; return os;
} }

View file

@ -59,17 +59,17 @@ class subGraph
// Private data // Private data
//- reference to the graph //- reference to the graph
graphType& data_; graphType& data_;
//- starts at row //- starts at row
const label start_; const label start_;
//- number of rows in the subGraph //- number of rows in the subGraph
const label size_; const label size_;
// Private member functions // Private member functions
//- check index //- check index
inline void checkIndex(const label i) const; inline void checkIndex(const label i) const;
public: public:
// Constructors // Constructors
@ -93,17 +93,17 @@ public:
inline label sizeOfRow(const label rowI) const; inline label sizeOfRow(const label rowI) const;
// Member Operators // Member Operators
//- Append an element to the given row //- Append an element to the given row
inline void append(const label rowI, const label); inline void append(const label rowI, const label);
//- Append an element to the given row if it does not exist there //- Append an element to the given row if it does not exist there
inline void appendIfNotIn(const label rowI, const label); inline void appendIfNotIn(const label rowI, const label);
//- check if the element is in the given row (takes linear time) //- check if the element is in the given row (takes linear time)
inline bool contains(const label rowI, const label e) const; inline bool contains(const label rowI, const label e) const;
inline label containsAtPosition(const label rowI, const label e) const; inline label containsAtPosition(const label rowI, const label e) const;
//- set and get operators //- set and get operators
inline label operator()(const label i, const label j) const; inline label operator()(const label i, const label j) const;
inline label& operator()(const label i, const label j); inline label& operator()(const label i, const label j);

View file

@ -137,7 +137,7 @@ inline Foam::label Foam::subGraph<graphType>::operator()
# ifdef FULLDEBUG # ifdef FULLDEBUG
checkIndex(i); checkIndex(i);
# endif # endif
return data_(start_+i, j); return data_(start_+i, j);
} }
@ -183,13 +183,13 @@ inline Foam::Ostream& operator<<
for(Foam::label j=0;j<sg.sizeOfRow(i);++j) for(Foam::label j=0;j<sg.sizeOfRow(i);++j)
{ {
if( j > 0 ) os << " "; if( j > 0 ) os << " ";
os << sg(i, j); os << sg(i, j);
} }
os << ")"; os << ")";
} }
os << "\n" << ")"; os << "\n" << ")";
return os; return os;

View file

@ -57,19 +57,19 @@ void Foam::fpmaMesh::writePoints(Foam::OFstream& fpmaGeometryFile) const
const point& p = points[pointI]; const point& p = points[pointI];
fpmaGeometryFile << p.x() << ' ' << p.y() << ' ' << p.z() << ' '; fpmaGeometryFile << p.x() << ' ' << p.y() << ' ' << p.z() << ' ';
} }
fpmaGeometryFile << nl; fpmaGeometryFile << nl;
} }
void fpmaMesh::writeCells(OFstream& fpmaGeometryFile) const void fpmaMesh::writeCells(OFstream& fpmaGeometryFile) const
{ {
const cellListPMG& cells = mesh_.cells(); const cellListPMG& cells = mesh_.cells();
fpmaGeometryFile << cells.size() << nl; fpmaGeometryFile << cells.size() << nl;
forAll(cells, cellI) forAll(cells, cellI)
{ {
const cell& c = cells[cellI]; const cell& c = cells[cellI];
fpmaGeometryFile << c.size(); fpmaGeometryFile << c.size();
forAll(c, fI) forAll(c, fI)
fpmaGeometryFile << ' ' << c[fI]; fpmaGeometryFile << ' ' << c[fI];
@ -84,7 +84,7 @@ void Foam::fpmaMesh::writeFaces(OFstream& fpmaGeometryFile) const
forAll(faces, faceI) forAll(faces, faceI)
{ {
const face& f = faces[faceI]; const face& f = faces[faceI];
fpmaGeometryFile << f.size(); fpmaGeometryFile << f.size();
forAllReverse(f, pI) forAllReverse(f, pI)
fpmaGeometryFile << ' ' << f[pI]; fpmaGeometryFile << ' ' << f[pI];
@ -96,9 +96,9 @@ void Foam::fpmaMesh::writeSubsets(Foam::OFstream& fpmaGeometryFile) const
{ {
//- write patches as face selections //- write patches as face selections
const PtrList<boundaryPatch>& patches = mesh_.boundaries(); const PtrList<boundaryPatch>& patches = mesh_.boundaries();
label nSubsets(0); label nSubsets(0);
nSubsets += patches.size(); nSubsets += patches.size();
DynList<label> indices; DynList<label> indices;
mesh_.pointSubsetIndices(indices); mesh_.pointSubsetIndices(indices);
@ -110,15 +110,15 @@ void Foam::fpmaMesh::writeSubsets(Foam::OFstream& fpmaGeometryFile) const
mesh_.cellSubsetIndices(indices); mesh_.cellSubsetIndices(indices);
nSubsets += indices.size(); nSubsets += indices.size();
Info << "Mesh has " << indices.size() << " cell subsets" << endl; Info << "Mesh has " << indices.size() << " cell subsets" << endl;
fpmaGeometryFile << nSubsets << nl; fpmaGeometryFile << nSubsets << nl;
//- write patches as face selections //- write patches as face selections
forAll(patches, patchI) forAll(patches, patchI)
{ {
label start = patches[patchI].patchStart(); label start = patches[patchI].patchStart();
const label size = patches[patchI].patchSize(); const label size = patches[patchI].patchSize();
fpmaGeometryFile << patches[patchI].patchName() << nl; fpmaGeometryFile << patches[patchI].patchName() << nl;
fpmaGeometryFile << 3 << nl; fpmaGeometryFile << 3 << nl;
fpmaGeometryFile << size << nl; fpmaGeometryFile << size << nl;
@ -126,14 +126,14 @@ void Foam::fpmaMesh::writeSubsets(Foam::OFstream& fpmaGeometryFile) const
fpmaGeometryFile << start++ << ' '; fpmaGeometryFile << start++ << ' ';
fpmaGeometryFile << nl; fpmaGeometryFile << nl;
} }
//- write node selections //- write node selections
mesh_.pointSubsetIndices(indices); mesh_.pointSubsetIndices(indices);
forAll(indices, indexI) forAll(indices, indexI)
{ {
labelLongList nodesInSubset; labelLongList nodesInSubset;
mesh_.pointsInSubset(indices[indexI], nodesInSubset); mesh_.pointsInSubset(indices[indexI], nodesInSubset);
fpmaGeometryFile << mesh_.pointSubsetName(indices[indexI]) << nl; fpmaGeometryFile << mesh_.pointSubsetName(indices[indexI]) << nl;
fpmaGeometryFile << 1 << nl; fpmaGeometryFile << 1 << nl;
fpmaGeometryFile << nodesInSubset.size() << nl; fpmaGeometryFile << nodesInSubset.size() << nl;
@ -141,14 +141,14 @@ void Foam::fpmaMesh::writeSubsets(Foam::OFstream& fpmaGeometryFile) const
fpmaGeometryFile << nodesInSubset[i] << ' '; fpmaGeometryFile << nodesInSubset[i] << ' ';
fpmaGeometryFile << nl; fpmaGeometryFile << nl;
} }
//- write face selections //- write face selections
mesh_.faceSubsetIndices(indices); mesh_.faceSubsetIndices(indices);
forAll(indices, indexI) forAll(indices, indexI)
{ {
labelLongList facesInSubset; labelLongList facesInSubset;
mesh_.facesInSubset(indices[indexI], facesInSubset); mesh_.facesInSubset(indices[indexI], facesInSubset);
fpmaGeometryFile << mesh_.faceSubsetName(indices[indexI]) << nl; fpmaGeometryFile << mesh_.faceSubsetName(indices[indexI]) << nl;
fpmaGeometryFile << 3 << nl; fpmaGeometryFile << 3 << nl;
fpmaGeometryFile << facesInSubset.size() << nl; fpmaGeometryFile << facesInSubset.size() << nl;
@ -156,14 +156,14 @@ void Foam::fpmaMesh::writeSubsets(Foam::OFstream& fpmaGeometryFile) const
fpmaGeometryFile << facesInSubset[i] << ' '; fpmaGeometryFile << facesInSubset[i] << ' ';
fpmaGeometryFile << nl; fpmaGeometryFile << nl;
} }
//- write cell selections //- write cell selections
mesh_.cellSubsetIndices(indices); mesh_.cellSubsetIndices(indices);
forAll(indices, indexI) forAll(indices, indexI)
{ {
labelLongList cellsInSubset; labelLongList cellsInSubset;
mesh_.cellsInSubset(indices[indexI], cellsInSubset); mesh_.cellsInSubset(indices[indexI], cellsInSubset);
fpmaGeometryFile << mesh_.cellSubsetName(indices[indexI]) << nl; fpmaGeometryFile << mesh_.cellSubsetName(indices[indexI]) << nl;
fpmaGeometryFile << 2 << nl; fpmaGeometryFile << 2 << nl;
fpmaGeometryFile << cellsInSubset.size() << nl; fpmaGeometryFile << cellsInSubset.size() << nl;
@ -177,7 +177,7 @@ void Foam::fpmaMesh::writeSubsets(Foam::OFstream& fpmaGeometryFile) const
void fpmaMesh::write(OFstream& fpmaGeometryFile) const void fpmaMesh::write(OFstream& fpmaGeometryFile) const
{ {
writePoints(fpmaGeometryFile); writePoints(fpmaGeometryFile);
writeFaces(fpmaGeometryFile); writeFaces(fpmaGeometryFile);
writeCells(fpmaGeometryFile); writeCells(fpmaGeometryFile);

View file

@ -60,11 +60,11 @@ class fpmaMesh
void operator=(const fpmaMesh&); void operator=(const fpmaMesh&);
void writePoints(OFstream& fpmaGeometryFile) const; void writePoints(OFstream& fpmaGeometryFile) const;
void writeFaces(OFstream& fpmaGeometryFile) const; void writeFaces(OFstream& fpmaGeometryFile) const;
void writeCells(OFstream& fpmaGeometryFile) const; void writeCells(OFstream& fpmaGeometryFile) const;
void writeSubsets(OFstream& fpmaGeometryFile) const; void writeSubsets(OFstream& fpmaGeometryFile) const;
public: public:

View file

@ -44,7 +44,7 @@ namespace Foam
{ {
class polyMeshGen; class polyMeshGen;
void writeMeshFPMA(const polyMeshGen& mesh, const word& fName); void writeMeshFPMA(const polyMeshGen& mesh, const word& fName);
void createFIRESelections(polyMeshGen& mesh); void createFIRESelections(polyMeshGen& mesh);

View file

@ -28,7 +28,7 @@ Description
Decomposes selected cells into pyramids Decomposes selected cells into pyramids
SourceFiles SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -56,16 +56,16 @@ class decomposeCells
wordList patchNames_; wordList patchNames_;
VRWGraph newBoundaryFaces_; VRWGraph newBoundaryFaces_;
labelLongList newBoundaryPatches_; labelLongList newBoundaryPatches_;
VRWGraphList facesOfNewCells_; VRWGraphList facesOfNewCells_;
// Private member functions // Private member functions
//- check if the valid pyramids are generated from the split cells //- check if the valid pyramids are generated from the split cells
//- this check splits faces which could //- this check splits faces which could
//- result in multiple inbetween faces //- result in multiple inbetween faces
void checkFaceConnections(const boolList& decomposeCell); void checkFaceConnections(const boolList& decomposeCell);
//- create addressing needed to decompose the cell //- create addressing needed to decompose the cell
void findAddressingForCell void findAddressingForCell
( (
@ -75,7 +75,7 @@ class decomposeCells
DynList<DynList<label, 8> >& faceEdges, DynList<DynList<label, 8> >& faceEdges,
DynList<DynList<label, 2>, 64>& edgeFaces DynList<DynList<label, 2>, 64>& edgeFaces
) const; ) const;
//- find the apex of the pyramids //- find the apex of the pyramids
label findTopVertex label findTopVertex
( (
@ -84,15 +84,15 @@ class decomposeCells
const DynList<edge, 64>& edges, const DynList<edge, 64>& edges,
const DynList<DynList<label, 2>, 64>& edgeFaces const DynList<DynList<label, 2>, 64>& edgeFaces
); );
void decomposeCellIntoPyramids(const label cellI); void decomposeCellIntoPyramids(const label cellI);
void createPointsAndCellFaces(const boolList& decomposeCell); void createPointsAndCellFaces(const boolList& decomposeCell);
void storeBoundaryFaces(const boolList& decomposeCell); void storeBoundaryFaces(const boolList& decomposeCell);
void removeDecomposedCells(const boolList& decomposeCell); void removeDecomposedCells(const boolList& decomposeCell);
void addNewCells(); void addNewCells();
//- disallows bitwise construct //- disallows bitwise construct

View file

@ -50,7 +50,7 @@ class decomposeFaces
// private data // private data
//- reference to the mesh //- reference to the mesh
polyMeshGen& mesh_; polyMeshGen& mesh_;
//- number of points //- number of points
VRWGraph newFacesForFace_; VRWGraph newFacesForFace_;

View file

@ -56,7 +56,7 @@ label faceDecomposition::concaveVertex() const
evn /= mag(evn); evn /= mag(evn);
const vector prod = (ev ^ evn); const vector prod = (ev ^ evn);
if( (prod & n) < -SMALL ) if( (prod & n) < -SMALL )
{ {
if( concaveVrt != -1 ) if( concaveVrt != -1 )
@ -134,7 +134,7 @@ bool faceDecomposition::isFacePlanar() const
const point c = f_.centre(points_); const point c = f_.centre(points_);
forAll(f_, pI) forAll(f_, pI)
tol = Foam::max(tol, Foam::mag(c - points_[f_[pI]])); tol = Foam::max(tol, Foam::mag(c - points_[f_[pI]]));
tol *= 0.05; tol *= 0.05;
return isFacePlanar(tol); return isFacePlanar(tol);
@ -191,7 +191,7 @@ faceList faceDecomposition::decomposeFace() const
if( il == ir - 1 ) if( il == ir - 1 )
storage.newElmt(fI++) = rf; storage.newElmt(fI++) = rf;
} }
il++; il++;
ir--; ir--;
@ -256,7 +256,7 @@ faceList faceDecomposition::decomposeFaceIntoTriangles(const label cv) const
add[0] = f_[start]; add[0] = f_[start];
add[1] = edg[i].start(); add[1] = edg[i].start();
add[2] = edg[i].end(); add[2] = edg[i].end();
fcs.newElmt(fI++) = add; fcs.newElmt(fI++) = add;
} }
@ -266,12 +266,12 @@ faceList faceDecomposition::decomposeFaceIntoTriangles(const label cv) const
Info << "face " << faceNo << " " << f_ Info << "face " << faceNo << " " << f_
<< " is decomposed into " << fcs << endl; << " is decomposed into " << fcs << endl;
# endif # endif
return fcs; return fcs;
} }
faceList fcs(1, f_); faceList fcs(1, f_);
return fcs; return fcs;
} }

View file

@ -49,14 +49,14 @@ class faceDecomposition
{ {
// private data // private data
const face& f_; const face& f_;
const pointField& points_; const pointField& points_;
// private member functions // private member functions
//- find concave vertex and return its position //- find concave vertex and return its position
//- in the face //- in the face
label concaveVertex() const; label concaveVertex() const;
//- decomposes the face into triangle starting from //- decomposes the face into triangle starting from
//- the given vertex //- the given vertex
faceList decomposeFaceIntoTriangles(const label cv) const; faceList decomposeFaceIntoTriangles(const label cv) const;
@ -91,7 +91,7 @@ public:
//- decompose face into triangles //- decompose face into triangles
faceList decomposeFaceIntoTriangles() const; faceList decomposeFaceIntoTriangles() const;
//- decompose face into the minimal number //- decompose face into the minimal number
//- of convex faces //- of convex faces
faceList decomposeFace() const; faceList decomposeFace() const;

View file

@ -47,18 +47,18 @@ namespace Foam
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class labelledMeshOctreeCubeCoordinates Declaration Class labelledMeshOctreeCubeCoordinates Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class labelledMeshOctreeCubeCoordinates class labelledMeshOctreeCubeCoordinates
{ {
// Private data // Private data
//- label //- label
label cLabel_; label cLabel_;
//- cube coordinates //- cube coordinates
meshOctreeCubeCoordinates coordinates_; meshOctreeCubeCoordinates coordinates_;
public: public:
// Constructors // Constructors
//- Null construct //- Null construct
labelledMeshOctreeCubeCoordinates() labelledMeshOctreeCubeCoordinates()
@ -66,7 +66,7 @@ class labelledMeshOctreeCubeCoordinates
cLabel_(-1), cLabel_(-1),
coordinates_() coordinates_()
{} {}
//- Construct from label and cube coordinates //- Construct from label and cube coordinates
labelledMeshOctreeCubeCoordinates labelledMeshOctreeCubeCoordinates
( (
@ -77,32 +77,32 @@ class labelledMeshOctreeCubeCoordinates
cLabel_(cl), cLabel_(cl),
coordinates_(cc) coordinates_(cc)
{} {}
// Destructor // Destructor
~labelledMeshOctreeCubeCoordinates() ~labelledMeshOctreeCubeCoordinates()
{} {}
// Member functions // Member functions
//- return cube label //- return cube label
inline label cubeLabel() const inline label cubeLabel() const
{ {
return cLabel_; return cLabel_;
} }
//- return the value //- return the value
inline const meshOctreeCubeCoordinates& coordinates() const inline const meshOctreeCubeCoordinates& coordinates() const
{ {
return coordinates_; return coordinates_;
} }
// Member operators // Member operators
inline void operator=(const labelledMeshOctreeCubeCoordinates& lcc) inline void operator=(const labelledMeshOctreeCubeCoordinates& lcc)
{ {
cLabel_ = lcc.cLabel_; cLabel_ = lcc.cLabel_;
coordinates_ = lcc.coordinates_; coordinates_ = lcc.coordinates_;
} }
inline bool operator== inline bool operator==
( (
const labelledMeshOctreeCubeCoordinates& lcc const labelledMeshOctreeCubeCoordinates& lcc
@ -110,10 +110,10 @@ class labelledMeshOctreeCubeCoordinates
{ {
if( cLabel_ == lcc.cLabel_ ) if( cLabel_ == lcc.cLabel_ )
return true; return true;
return false; return false;
} }
inline bool operator!= inline bool operator!=
( (
const labelledMeshOctreeCubeCoordinates& lcc const labelledMeshOctreeCubeCoordinates& lcc
@ -121,7 +121,7 @@ class labelledMeshOctreeCubeCoordinates
{ {
return !this->operator==(lcc); return !this->operator==(lcc);
} }
// Friend operators // Friend operators
friend Ostream& operator<< friend Ostream& operator<<
( (
@ -141,7 +141,7 @@ class labelledMeshOctreeCubeCoordinates
return os; return os;
} }
friend Istream& operator>> friend Istream& operator>>
( (
Istream& is, Istream& is,
@ -150,16 +150,16 @@ class labelledMeshOctreeCubeCoordinates
{ {
// Read beginning of labelledMeshOctreeCubeCoordinates // Read beginning of labelledMeshOctreeCubeCoordinates
is.readBegin("labelledMeshOctreeCubeCoordinates"); is.readBegin("labelledMeshOctreeCubeCoordinates");
is >> lcc.cLabel_; is >> lcc.cLabel_;
is >> lcc.coordinates_; is >> lcc.coordinates_;
// Read end of labelledMeshOctreeCubeCoordinates // Read end of labelledMeshOctreeCubeCoordinates
is.readEnd("labelledMeshOctreeCubeCoordinates"); is.readEnd("labelledMeshOctreeCubeCoordinates");
// Check state of Istream // Check state of Istream
is.check("operator>>(Istream&, labelledMeshOctreeCubeCoordinates"); is.check("operator>>(Istream&, labelledMeshOctreeCubeCoordinates");
return is; return is;
} }
}; };

View file

@ -47,18 +47,18 @@ namespace Foam
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class labelledPoint Declaration Class labelledPoint Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class labelledPoint class labelledPoint
{ {
// Private data // Private data
//- point label //- point label
label pLabel_; label pLabel_;
//- point coordinates //- point coordinates
point coords_; point coords_;
public: public:
// Constructors // Constructors
//- Null construct //- Null construct
labelledPoint() labelledPoint()
@ -66,62 +66,62 @@ class labelledPoint
pLabel_(-1), pLabel_(-1),
coords_(vector::zero) coords_(vector::zero)
{} {}
//- Construct from point and label //- Construct from point and label
labelledPoint(const label pl, const point& p) labelledPoint(const label pl, const point& p)
: :
pLabel_(pl), pLabel_(pl),
coords_(p) coords_(p)
{} {}
// Destructor // Destructor
~labelledPoint() ~labelledPoint()
{} {}
// Member functions // Member functions
//- return point label //- return point label
inline label pointLabel() const inline label pointLabel() const
{ {
return pLabel_; return pLabel_;
} }
inline label& pointLabel() inline label& pointLabel()
{ {
return pLabel_; return pLabel_;
} }
//- return point coordinates //- return point coordinates
inline const point& coordinates() const inline const point& coordinates() const
{ {
return coords_; return coords_;
} }
inline point& coordinates() inline point& coordinates()
{ {
return coords_; return coords_;
} }
// Member operators // Member operators
inline void operator=(const labelledPoint& lp) inline void operator=(const labelledPoint& lp)
{ {
pLabel_ = lp.pLabel_; pLabel_ = lp.pLabel_;
coords_ = lp.coords_; coords_ = lp.coords_;
} }
inline bool operator==(const labelledPoint& lp) const inline bool operator==(const labelledPoint& lp) const
{ {
if( pLabel_ == lp.pLabel_ ) if( pLabel_ == lp.pLabel_ )
return true; return true;
return false; return false;
} }
inline bool operator!=(const labelledPoint& lp) const inline bool operator!=(const labelledPoint& lp) const
{ {
return !this->operator==(lp); return !this->operator==(lp);
} }
// Friend operators // Friend operators
friend Ostream& operator<<(Ostream& os, const labelledPoint& lp) friend Ostream& operator<<(Ostream& os, const labelledPoint& lp)
{ {
@ -134,21 +134,21 @@ class labelledPoint
return os; return os;
} }
friend Istream& operator>>(Istream& is, labelledPoint& lp) friend Istream& operator>>(Istream& is, labelledPoint& lp)
{ {
// Read beginning of labelledPoint // Read beginning of labelledPoint
is.readBegin("labelledPoint"); is.readBegin("labelledPoint");
is >> lp.pLabel_; is >> lp.pLabel_;
is >> lp.coords_; is >> lp.coords_;
// Read end of labelledPoint // Read end of labelledPoint
is.readEnd("labelledPoint"); is.readEnd("labelledPoint");
// Check state of Istream // Check state of Istream
is.check("operator>>(Istream&, labelledPoint"); is.check("operator>>(Istream&, labelledPoint");
return is; return is;
} }
}; };

View file

@ -46,18 +46,18 @@ namespace Foam
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class refLabelledPoint Declaration Class refLabelledPoint Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class refLabelledPoint class refLabelledPoint
{ {
// Private data // Private data
//- label of the object it is associated to //- label of the object it is associated to
label objectLabel_; label objectLabel_;
//- point to be transferred //- point to be transferred
labelledPoint p_; labelledPoint p_;
public: public:
// Constructors // Constructors
//- Null construct //- Null construct
refLabelledPoint() refLabelledPoint()
@ -65,52 +65,52 @@ class refLabelledPoint
objectLabel_(-1), objectLabel_(-1),
p_() p_()
{} {}
//- Construct from label and labelledPoint //- Construct from label and labelledPoint
refLabelledPoint(const label pl, const labelledPoint& p) refLabelledPoint(const label pl, const labelledPoint& p)
: :
objectLabel_(pl), objectLabel_(pl),
p_(p) p_(p)
{} {}
// Destructor // Destructor
~refLabelledPoint() ~refLabelledPoint()
{} {}
// Member functions // Member functions
//- return label of the object it is associated to //- return label of the object it is associated to
inline label objectLabel() const inline label objectLabel() const
{ {
return objectLabel_; return objectLabel_;
} }
//- return labelledPoint //- return labelledPoint
inline const labelledPoint& lPoint() const inline const labelledPoint& lPoint() const
{ {
return p_; return p_;
} }
// Member operators // Member operators
inline void operator=(const refLabelledPoint& lp) inline void operator=(const refLabelledPoint& lp)
{ {
objectLabel_ = lp.objectLabel_; objectLabel_ = lp.objectLabel_;
p_ = lp.p_; p_ = lp.p_;
} }
inline bool operator==(const refLabelledPoint& lp) const inline bool operator==(const refLabelledPoint& lp) const
{ {
if( objectLabel_ == lp.objectLabel_ ) if( objectLabel_ == lp.objectLabel_ )
return true; return true;
return false; return false;
} }
inline bool operator!=(const refLabelledPoint& lp) const inline bool operator!=(const refLabelledPoint& lp) const
{ {
return !this->operator==(lp); return !this->operator==(lp);
} }
// Friend operators // Friend operators
friend Ostream& operator<<(Ostream& os, const refLabelledPoint& lp) friend Ostream& operator<<(Ostream& os, const refLabelledPoint& lp)
{ {
@ -123,21 +123,21 @@ class refLabelledPoint
return os; return os;
} }
friend Istream& operator>>(Istream& is, refLabelledPoint& lp) friend Istream& operator>>(Istream& is, refLabelledPoint& lp)
{ {
// Read beginning of refLabelledPoint // Read beginning of refLabelledPoint
is.readBegin("refLabelledPoint"); is.readBegin("refLabelledPoint");
is >> lp.objectLabel_; is >> lp.objectLabel_;
is >> lp.p_; is >> lp.p_;
// Read end of refLabelledPoint // Read end of refLabelledPoint
is.readEnd("refLabelledPoint"); is.readEnd("refLabelledPoint");
// Check state of Istream // Check state of Istream
is.check("operator>>(Istream&, refLabelledPoint"); is.check("operator>>(Istream&, refLabelledPoint");
return is; return is;
} }
}; };

View file

@ -47,21 +47,21 @@ namespace Foam
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class labelledPointScalar Declaration Class labelledPointScalar Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class labelledPointScalar class labelledPointScalar
{ {
// Private data // Private data
//- point label //- point label
label pLabel_; label pLabel_;
//- point coordinates //- point coordinates
point coords_; point coords_;
//- scalar data //- scalar data
scalar weight_; scalar weight_;
public: public:
// Constructors // Constructors
//- Null construct //- Null construct
labelledPointScalar() labelledPointScalar()
@ -70,7 +70,7 @@ class labelledPointScalar
coords_(vector::zero), coords_(vector::zero),
weight_(0.0) weight_(0.0)
{} {}
//- Construct from point and label //- Construct from point and label
labelledPointScalar(const label pl, const point& p, const scalar s) labelledPointScalar(const label pl, const point& p, const scalar s)
: :
@ -78,67 +78,67 @@ class labelledPointScalar
coords_(p), coords_(p),
weight_(s) weight_(s)
{} {}
// Destructor // Destructor
~labelledPointScalar() ~labelledPointScalar()
{} {}
// Member functions // Member functions
//- return point label //- return point label
inline label pointLabel() const inline label pointLabel() const
{ {
return pLabel_; return pLabel_;
} }
inline label& pointLabel() inline label& pointLabel()
{ {
return pLabel_; return pLabel_;
} }
//- return point coordinates //- return point coordinates
inline const point& coordinates() const inline const point& coordinates() const
{ {
return coords_; return coords_;
} }
inline point& coordinates() inline point& coordinates()
{ {
return coords_; return coords_;
} }
//- return scalar value //- return scalar value
inline const scalar& scalarValue() const inline const scalar& scalarValue() const
{ {
return weight_; return weight_;
} }
inline scalar& scalarValue() inline scalar& scalarValue()
{ {
return weight_; return weight_;
} }
// Member operators // Member operators
inline void operator=(const labelledPointScalar& lps) inline void operator=(const labelledPointScalar& lps)
{ {
pLabel_ = lps.pLabel_; pLabel_ = lps.pLabel_;
coords_ = lps.coords_; coords_ = lps.coords_;
weight_ = lps.weight_; weight_ = lps.weight_;
} }
inline bool operator==(const labelledPointScalar& lps) const inline bool operator==(const labelledPointScalar& lps) const
{ {
if( pLabel_ == lps.pLabel_ ) if( pLabel_ == lps.pLabel_ )
return true; return true;
return false; return false;
} }
inline bool operator!=(const labelledPointScalar& lps) const inline bool operator!=(const labelledPointScalar& lps) const
{ {
return !this->operator==(lps); return !this->operator==(lps);
} }
// Friend operators // Friend operators
friend Ostream& operator<<(Ostream& os, const labelledPointScalar& lps) friend Ostream& operator<<(Ostream& os, const labelledPointScalar& lps)
{ {
@ -152,22 +152,22 @@ class labelledPointScalar
return os; return os;
} }
friend Istream& operator>>(Istream& is, labelledPointScalar& lps) friend Istream& operator>>(Istream& is, labelledPointScalar& lps)
{ {
// Read beginning of labelledPointScalar // Read beginning of labelledPointScalar
is.readBegin("labelledPointScalar"); is.readBegin("labelledPointScalar");
is >> lps.pLabel_; is >> lps.pLabel_;
is >> lps.coords_; is >> lps.coords_;
is >> lps.weight_; is >> lps.weight_;
// Read end of labelledPointScalar // Read end of labelledPointScalar
is.readEnd("labelledPointScalar"); is.readEnd("labelledPointScalar");
// Check state of Istream // Check state of Istream
is.check("operator>>(Istream&, labelledPointScalar"); is.check("operator>>(Istream&, labelledPointScalar");
return is; return is;
} }
}; };

View file

@ -46,19 +46,19 @@ namespace Foam
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class parPartTet Declaration Class parPartTet Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class parPartTet class parPartTet
{ {
// Private data // Private data
labelledPoint pts_[4]; labelledPoint pts_[4];
public: public:
// Constructors // Constructors
inline parPartTet() inline parPartTet()
{} {}
explicit inline parPartTet explicit inline parPartTet
( (
const labelledPoint& p0, const labelledPoint& p0,
@ -72,31 +72,31 @@ public:
pts_[2] = p2; pts_[2] = p2;
pts_[3] = p3; pts_[3] = p3;
} }
// Destructor // Destructor
~parPartTet() ~parPartTet()
{} {}
// Member functions // Member functions
// Member operators // Member operators
inline const labelledPoint& operator[](const label i) const inline const labelledPoint& operator[](const label i) const
{ {
return pts_[i]; return pts_[i];
} }
inline bool operator !=(const parPartTet& ptf) const inline bool operator !=(const parPartTet& ptf) const
{ {
Serr << "Not implemented" << endl; Serr << "Not implemented" << endl;
::exit(1); ::exit(1);
return true; return true;
} }
// Friend operators // Friend operators
inline friend Ostream& operator<<(Ostream& os, const parPartTet& ppt) inline friend Ostream& operator<<(Ostream& os, const parPartTet& ppt)
{ {
os << token::BEGIN_LIST; os << token::BEGIN_LIST;
@ -110,21 +110,21 @@ public:
os.check("operator<<(Ostream&, const parPartTet&"); os.check("operator<<(Ostream&, const parPartTet&");
return os; return os;
} }
inline friend Istream& operator>>(Istream& is, parPartTet& ppt) inline friend Istream& operator>>(Istream& is, parPartTet& ppt)
{ {
// Read beginning of parPartTet // Read beginning of parPartTet
is.readBegin("parPartTet"); is.readBegin("parPartTet");
for(label i=0;i<4;++i) for(label i=0;i<4;++i)
is >> ppt.pts_[i]; is >> ppt.pts_[i];
// Read end of parHelper // Read end of parHelper
is.readEnd("parPartTet"); is.readEnd("parPartTet");
// Check state of Istream // Check state of Istream
is.check("operator>>(Istream&, parPartTet"); is.check("operator>>(Istream&, parPartTet");
return is; return is;
} }
}; };

View file

@ -52,41 +52,41 @@ class sortEdgesIntoChains
{ {
// Members // Members
const DynList<edge>& bEdges_; const DynList<edge>& bEdges_;
bool openEdges_; bool openEdges_;
Map<label> newNodeLabel_; Map<label> newNodeLabel_;
List<DynList<label> > edgesAtPoint_; List<DynList<label> > edgesAtPoint_;
DynList<labelList> createdChains_; DynList<labelList> createdChains_;
// Private member functions // Private member functions
void createNodeLabels(); void createNodeLabels();
bool findPointsBelongingToTheChain bool findPointsBelongingToTheChain
( (
const label currPos, const label currPos,
boolList& chainEdges boolList& chainEdges
) const; ) const;
void shrinkEdges(const boolList& chainEdges); void shrinkEdges(const boolList& chainEdges);
void createChainFromEdges(const boolList& chainEdges); void createChainFromEdges(const boolList& chainEdges);
void sortEdges(); void sortEdges();
public: public:
sortEdgesIntoChains sortEdgesIntoChains
( (
const DynList<edge>& bEdges const DynList<edge>& bEdges
); );
~sortEdgesIntoChains(); ~sortEdgesIntoChains();
// Member functions // Member functions
//- a list of points which have not yet been resolved //- a list of points which have not yet been resolved
const DynList<labelList>& sortedChains() const; const DynList<labelList>& sortedChains() const;
}; };

View file

@ -43,7 +43,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace help namespace help
{ {

View file

@ -46,7 +46,7 @@ scalar textToScalar(const word& w)
{ {
std::stringstream ss; std::stringstream ss;
ss << w; ss << w;
double s; double s;
ss >> s; ss >> s;
return s; return s;
@ -62,7 +62,7 @@ word scalarToText(const scalar s)
{ {
std::ostringstream ss; std::ostringstream ss;
ss << s; ss << s;
return ss.str(); return ss.str();
} }
@ -70,7 +70,7 @@ word labelToText(const label l)
{ {
std::ostringstream ss; std::ostringstream ss;
ss << l; ss << l;
return ss.str(); return ss.str();
} }

View file

@ -52,13 +52,13 @@ namespace help
//- convert the text to scalar //- convert the text to scalar
scalar textToScalar(const word& w); scalar textToScalar(const word& w);
//- convert the text to label //- convert the text to label
label textToLabel(const word& w); label textToLabel(const word& w);
//- convert the scalar value into text //- convert the scalar value into text
word scalarToText(const scalar s); word scalarToText(const scalar s);
//- convert the integer value into text //- convert the integer value into text
word labelToText(const label l); word labelToText(const label l);

View file

@ -38,9 +38,9 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void partTetMesh::createPointsAndTets(const List<direction>& useCell) void partTetMesh::createPointsAndTets(const List<direction>& useCell)
{ {
const pointFieldPMG& points = origMesh_.points(); const pointFieldPMG& points = origMesh_.points();
@ -52,88 +52,88 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
const PtrList<processorBoundaryPatch>& procBoundaries = const PtrList<processorBoundaryPatch>& procBoundaries =
origMesh_.procBoundaries(); origMesh_.procBoundaries();
const label nInternalFaces = origMesh_.nInternalFaces(); const label nInternalFaces = origMesh_.nInternalFaces();
//- check how many neighbours of a face are marked for smoothing //- check how many neighbours of a face are marked for smoothing
labelList usedFace(faces.size(), 0); labelList usedFace(faces.size(), 0);
//- mark faces //- mark faces
forAll(faces, faceI) forAll(faces, faceI)
{ {
if( useCell[owner[faceI]] ) if( useCell[owner[faceI]] )
++usedFace[faceI]; ++usedFace[faceI];
if( neighbour[faceI] < 0 ) if( neighbour[faceI] < 0 )
continue; continue;
if( useCell[neighbour[faceI]] ) if( useCell[neighbour[faceI]] )
++usedFace[faceI]; ++usedFace[faceI];
} }
//- send data at processor boundaries //- send data at processor boundaries
forAll(procBoundaries, patchI) forAll(procBoundaries, patchI)
{ {
const label start = procBoundaries[patchI].patchStart(); const label start = procBoundaries[patchI].patchStart();
const label size = procBoundaries[patchI].patchSize(); const label size = procBoundaries[patchI].patchSize();
labelLongList dataToSend; labelLongList dataToSend;
for(label faceI=0;faceI<size;++faceI) for(label faceI=0;faceI<size;++faceI)
{ {
if( usedFace[start+faceI] ) if( usedFace[start+faceI] )
dataToSend.append(faceI); dataToSend.append(faceI);
} }
OPstream toOtherProc OPstream toOtherProc
( (
Pstream::blocking, Pstream::blocking,
procBoundaries[patchI].neiProcNo(), procBoundaries[patchI].neiProcNo(),
dataToSend.byteSize() dataToSend.byteSize()
); );
toOtherProc << dataToSend; toOtherProc << dataToSend;
} }
//- receive data at proc boundaries //- receive data at proc boundaries
forAll(procBoundaries, patchI) forAll(procBoundaries, patchI)
{ {
labelLongList receivedData; labelLongList receivedData;
IPstream fromOtherProc IPstream fromOtherProc
( (
Pstream::blocking, Pstream::blocking,
procBoundaries[patchI].neiProcNo() procBoundaries[patchI].neiProcNo()
); );
fromOtherProc >> receivedData; fromOtherProc >> receivedData;
const label start = procBoundaries[patchI].patchStart(); const label start = procBoundaries[patchI].patchStart();
forAll(receivedData, faceI) forAll(receivedData, faceI)
++usedFace[start+receivedData[faceI]]; ++usedFace[start+receivedData[faceI]];
} }
const vectorField& faceCentres = origMesh_.addressingData().faceCentres(); const vectorField& faceCentres = origMesh_.addressingData().faceCentres();
const vectorField& cellCentres = origMesh_.addressingData().cellCentres(); const vectorField& cellCentres = origMesh_.addressingData().cellCentres();
labelLongList nodeLabelForPoint(points.size(), -1); labelLongList nodeLabelForPoint(points.size(), -1);
labelLongList nodeLabelForFace(faces.size(), -1); labelLongList nodeLabelForFace(faces.size(), -1);
labelLongList nodeLabelForCell(cells.size(), -1); labelLongList nodeLabelForCell(cells.size(), -1);
points_.clear(); points_.clear();
smoothVertex_.clear(); smoothVertex_.clear();
//- create BOUNDARY points //- create BOUNDARY points
forAll(boundaries, patchI) forAll(boundaries, patchI)
{ {
const boundaryPatch& patch = boundaries[patchI]; const boundaryPatch& patch = boundaries[patchI];
const label start = patch.patchStart(); const label start = patch.patchStart();
const label end = start + patch.patchSize(); const label end = start + patch.patchSize();
for(label faceI=start;faceI<end;++faceI) for(label faceI=start;faceI<end;++faceI)
{ {
if( !usedFace[faceI] ) if( !usedFace[faceI] )
continue; continue;
const face& f = faces[faceI]; const face& f = faces[faceI];
if( f.size() > 3 ) if( f.size() > 3 )
{ {
//- create face centre //- create face centre
@ -141,7 +141,7 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
points_.append(faceCentres[faceI]); points_.append(faceCentres[faceI]);
smoothVertex_.append(FACECENTRE); smoothVertex_.append(FACECENTRE);
} }
//- add face corners //- add face corners
forAll(f, pI) forAll(f, pI)
{ {
@ -150,27 +150,27 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
{ {
nodeLabelForPoint[pointI] = points_.size(); nodeLabelForPoint[pointI] = points_.size();
points_.append(points[pointI]); points_.append(points[pointI]);
smoothVertex_.append(BOUNDARY); smoothVertex_.append(BOUNDARY);
} }
} }
} }
} }
//- create points at processor boundaries //- create points at processor boundaries
forAll(procBoundaries, patchI) forAll(procBoundaries, patchI)
{ {
const processorBoundaryPatch& patch = procBoundaries[patchI]; const processorBoundaryPatch& patch = procBoundaries[patchI];
const label start = patch.patchStart(); const label start = patch.patchStart();
const label end = start + patch.patchSize(); const label end = start + patch.patchSize();
for(label faceI=start;faceI<end;++faceI) for(label faceI=start;faceI<end;++faceI)
{ {
if( !usedFace[faceI] ) if( !usedFace[faceI] )
continue; continue;
const face& f = faces[faceI]; const face& f = faces[faceI];
if( f.size() > 3 ) if( f.size() > 3 )
{ {
//- create face centre //- create face centre
@ -178,7 +178,7 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
points_.append(faceCentres[faceI]); points_.append(faceCentres[faceI]);
smoothVertex_.append(FACECENTRE); smoothVertex_.append(FACECENTRE);
} }
//- add face corners //- add face corners
const direction vType = usedFace[faceI]==2?SMOOTH:NONE; const direction vType = usedFace[faceI]==2?SMOOTH:NONE;
forAll(f, pI) forAll(f, pI)
@ -188,24 +188,24 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
{ {
nodeLabelForPoint[pointI] = points_.size(); nodeLabelForPoint[pointI] = points_.size();
points_.append(points[pointI]); points_.append(points[pointI]);
smoothVertex_.append(vType); smoothVertex_.append(vType);
} }
else if( vType == NONE ) else if( vType == NONE )
{ {
smoothVertex_[nodeLabelForPoint[pointI]] = NONE; smoothVertex_[nodeLabelForPoint[pointI]] = NONE;
} }
} }
} }
} }
//- create points for internal faces //- create points for internal faces
for(label faceI=0;faceI<nInternalFaces;++faceI) for(label faceI=0;faceI<nInternalFaces;++faceI)
{ {
if( usedFace[faceI] ) if( usedFace[faceI] )
{ {
const face& f = faces[faceI]; const face& f = faces[faceI];
if( f.size() > 3 ) if( f.size() > 3 )
{ {
//- create face centre //- create face centre
@ -213,7 +213,7 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
points_.append(faceCentres[faceI]); points_.append(faceCentres[faceI]);
smoothVertex_.append(FACECENTRE); smoothVertex_.append(FACECENTRE);
} }
//- add face corners //- add face corners
const direction vType = usedFace[faceI]==2?SMOOTH:NONE; const direction vType = usedFace[faceI]==2?SMOOTH:NONE;
forAll(f, pI) forAll(f, pI)
@ -223,28 +223,28 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
{ {
nodeLabelForPoint[pointI] = points_.size(); nodeLabelForPoint[pointI] = points_.size();
points_.append(points[pointI]); points_.append(points[pointI]);
smoothVertex_.append(vType); smoothVertex_.append(vType);
} }
else if( vType == NONE ) else if( vType == NONE )
{ {
smoothVertex_[nodeLabelForPoint[pointI]] = NONE; smoothVertex_[nodeLabelForPoint[pointI]] = NONE;
} }
} }
} }
} }
//- create tets //- create tets
tetMatcher tet; tetMatcher tet;
forAll(useCell, cI) forAll(useCell, cI)
if( useCell[cI] ) if( useCell[cI] )
{ {
const cell& c = cells[cI]; const cell& c = cells[cI];
if( tet.matchShape(false, faces, owner, cI, cells[cI]) ) if( tet.matchShape(false, faces, owner, cI, cells[cI]) )
{ {
const labelList& tVrt = tet.vertLabels(); const labelList& tVrt = tet.vertLabels();
//- add tet //- add tet
tets_.append tets_.append
( (
@ -256,19 +256,19 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
nodeLabelForPoint[tVrt[3]] nodeLabelForPoint[tVrt[3]]
) )
); );
continue; continue;
} }
nodeLabelForCell[cI] = points_.size(); nodeLabelForCell[cI] = points_.size();
const label centreLabel = points_.size(); const label centreLabel = points_.size();
points_.append(cellCentres[cI]); points_.append(cellCentres[cI]);
smoothVertex_.append(CELLCENTRE); smoothVertex_.append(CELLCENTRE);
forAll(c, fI) forAll(c, fI)
{ {
const face& f = faces[c[fI]]; const face& f = faces[c[fI]];
if( owner[c[fI]] == cI ) if( owner[c[fI]] == cI )
{ {
if( f.size() == 3 ) if( f.size() == 3 )
@ -280,12 +280,12 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
nodeLabelForPoint[f[1]], nodeLabelForPoint[f[1]],
centreLabel centreLabel
); );
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "1.1 Tet " << tets_.size() << " is " Info << "1.1 Tet " << tets_.size() << " is "
<< tet << endl; << tet << endl;
# endif # endif
tets_.append(tet); tets_.append(tet);
} }
else else
@ -299,12 +299,12 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
nodeLabelForFace[c[fI]], nodeLabelForFace[c[fI]],
centreLabel centreLabel
); );
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "1.2 Tet " << tets_.size() << " is " Info << "1.2 Tet " << tets_.size() << " is "
<< tet << endl; << tet << endl;
# endif # endif
tets_.append(tet); tets_.append(tet);
} }
} }
@ -320,12 +320,12 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
nodeLabelForPoint[f[2]], nodeLabelForPoint[f[2]],
centreLabel centreLabel
); );
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "2.1 Tet " << tets_.size() << " is " Info << "2.1 Tet " << tets_.size() << " is "
<< tet << endl; << tet << endl;
# endif # endif
tets_.append(tet); tets_.append(tet);
} }
else else
@ -339,19 +339,19 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
nodeLabelForFace[c[fI]], nodeLabelForFace[c[fI]],
centreLabel centreLabel
); );
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "2.2 Tet " << tets_.size() << " is " Info << "2.2 Tet " << tets_.size() << " is "
<< tet << endl; << tet << endl;
# endif # endif
tets_.append(tet); tets_.append(tet);
} }
} }
} }
} }
} }
//- create node labels in origMesh_ //- create node labels in origMesh_
nodeLabelInOrigMesh_.setSize(points_.size()); nodeLabelInOrigMesh_.setSize(points_.size());
nodeLabelInOrigMesh_ = -1; nodeLabelInOrigMesh_ = -1;
@ -360,10 +360,10 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
{ {
nodeLabelInOrigMesh_[nodeLabelForPoint[pI]] = pI; nodeLabelInOrigMesh_[nodeLabelForPoint[pI]] = pI;
} }
//- create pointTets_ //- create pointTets_
pointTets_.reverseAddressing(points_.size(), tets_); pointTets_.reverseAddressing(points_.size(), tets_);
//- create addressing for parallel runs //- create addressing for parallel runs
if( Pstream::parRun() ) if( Pstream::parRun() )
{ {
@ -373,13 +373,13 @@ void partTetMesh::createPointsAndTets(const List<direction>& useCell)
nodeLabelForFace, nodeLabelForFace,
nodeLabelForCell nodeLabelForCell
); );
createBufferLayers(); createBufferLayers();
} }
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
forAll(nodeLabelInOrigMesh_, pI) forAll(nodeLabelInOrigMesh_, pI)
if( if(
(nodeLabelInOrigMesh_[pI] != -1) && (nodeLabelInOrigMesh_[pI] != -1) &&
(mag(points_[pI] - points[nodeLabelInOrigMesh_[pI]]) > SMALL) (mag(points_[pI] - points[nodeLabelInOrigMesh_[pI]]) > SMALL)
) )
@ -395,18 +395,18 @@ void partTetMesh::createSMOOTHPointsOrdering() const
{ {
internalPointsOrderPtr_ = new VRWGraph(); internalPointsOrderPtr_ = new VRWGraph();
VRWGraph& internalPointsOrder = *internalPointsOrderPtr_; VRWGraph& internalPointsOrder = *internalPointsOrderPtr_;
internalPointsOrder.setSize(0); internalPointsOrder.setSize(0);
labelLongList order(points_.size(), -1); labelLongList order(points_.size(), -1);
boolList helper(points_.size()); boolList helper(points_.size());
bool found; bool found;
do do
{ {
found = false; found = false;
helper = false; helper = false;
labelLongList selectedPoints; labelLongList selectedPoints;
forAll(points_, nodeI) forAll(points_, nodeI)
{ {
if( smoothVertex_[nodeI] & SMOOTH ) if( smoothVertex_[nodeI] & SMOOTH )
@ -415,13 +415,13 @@ void partTetMesh::createSMOOTHPointsOrdering() const
continue; continue;
if( order[nodeI] != -1 ) if( order[nodeI] != -1 )
continue; continue;
//- find neighbouring FACECENTRE and CELLCENTRE points //- find neighbouring FACECENTRE and CELLCENTRE points
DynList<label, 64> neiCentrePoints, neiSmoothPoints; DynList<label, 64> neiCentrePoints, neiSmoothPoints;
forAllRow(pointTets_, nodeI, ptI) forAllRow(pointTets_, nodeI, ptI)
{ {
const partTet& tet = tets_[pointTets_(nodeI, ptI)]; const partTet& tet = tets_[pointTets_(nodeI, ptI)];
for(label i=0;i<4;++i) for(label i=0;i<4;++i)
if( smoothVertex_[tet[i]] & (FACECENTRE+CELLCENTRE) ) if( smoothVertex_[tet[i]] & (FACECENTRE+CELLCENTRE) )
{ {
@ -432,37 +432,37 @@ void partTetMesh::createSMOOTHPointsOrdering() const
neiSmoothPoints.appendIfNotIn(tet[i]); neiSmoothPoints.appendIfNotIn(tet[i]);
} }
} }
//- find neighbouring SMOOTH points //- find neighbouring SMOOTH points
forAll(neiCentrePoints, ncI) forAll(neiCentrePoints, ncI)
{ {
const label centreI = neiCentrePoints[ncI]; const label centreI = neiCentrePoints[ncI];
forAllRow(pointTets_, centreI, ptI) forAllRow(pointTets_, centreI, ptI)
{ {
const partTet& tet = tets_[pointTets_(centreI, ptI)]; const partTet& tet = tets_[pointTets_(centreI, ptI)];
for(label i=0;i<4;++i) for(label i=0;i<4;++i)
if( smoothVertex_[tet[i]] & SMOOTH ) if( smoothVertex_[tet[i]] & SMOOTH )
neiSmoothPoints.appendIfNotIn(tet[i]); neiSmoothPoints.appendIfNotIn(tet[i]);
} }
} }
//- select the point and mark neighbouring SMOOTH points //- select the point and mark neighbouring SMOOTH points
selectedPoints.append(nodeI); selectedPoints.append(nodeI);
order[nodeI] = internalPointsOrder.size(); order[nodeI] = internalPointsOrder.size();
forAll(neiSmoothPoints, i) forAll(neiSmoothPoints, i)
helper[neiSmoothPoints[i]] = true; helper[neiSmoothPoints[i]] = true;
} }
} }
if( selectedPoints.size() != 0 ) if( selectedPoints.size() != 0 )
{ {
internalPointsOrder.appendList(selectedPoints); internalPointsOrder.appendList(selectedPoints);
found = true; found = true;
} }
} while( found ); } while( found );
} }
@ -470,17 +470,17 @@ void partTetMesh::createBOUNDARYPointsOrdering() const
{ {
boundaryPointsOrderPtr_ = new VRWGraph(); boundaryPointsOrderPtr_ = new VRWGraph();
VRWGraph& boundaryPointsOrder = *boundaryPointsOrderPtr_; VRWGraph& boundaryPointsOrder = *boundaryPointsOrderPtr_;
boundaryPointsOrder.setSize(0); boundaryPointsOrder.setSize(0);
labelLongList order(points_.size(), -1); labelLongList order(points_.size(), -1);
boolList helper(points_.size()); boolList helper(points_.size());
bool found; bool found;
do do
{ {
found = false; found = false;
helper = false; helper = false;
labelLongList selectedPoints; labelLongList selectedPoints;
forAll(points_, nodeI) forAll(points_, nodeI)
{ {
@ -490,13 +490,13 @@ void partTetMesh::createBOUNDARYPointsOrdering() const
continue; continue;
if( order[nodeI] != -1 ) if( order[nodeI] != -1 )
continue; continue;
//- find neighbouring FACECENTRE and CELLCENTRE points //- find neighbouring FACECENTRE and CELLCENTRE points
DynList<label, 64> neiCentrePoints, neiSmoothPoints; DynList<label, 64> neiCentrePoints, neiSmoothPoints;
forAllRow(pointTets_, nodeI, ptI) forAllRow(pointTets_, nodeI, ptI)
{ {
const partTet& tet = tets_[pointTets_(nodeI, ptI)]; const partTet& tet = tets_[pointTets_(nodeI, ptI)];
for(label i=0;i<4;++i) for(label i=0;i<4;++i)
if( smoothVertex_[tet[i]] & (FACECENTRE+CELLCENTRE) ) if( smoothVertex_[tet[i]] & (FACECENTRE+CELLCENTRE) )
{ {
@ -507,37 +507,37 @@ void partTetMesh::createBOUNDARYPointsOrdering() const
neiSmoothPoints.appendIfNotIn(tet[i]); neiSmoothPoints.appendIfNotIn(tet[i]);
} }
} }
//- find neighbouring BOUNDARY points //- find neighbouring BOUNDARY points
forAll(neiCentrePoints, ncI) forAll(neiCentrePoints, ncI)
{ {
const label centreI = neiCentrePoints[ncI]; const label centreI = neiCentrePoints[ncI];
forAllRow(pointTets_, centreI, ptI) forAllRow(pointTets_, centreI, ptI)
{ {
const partTet& tet = tets_[pointTets_(centreI, ptI)]; const partTet& tet = tets_[pointTets_(centreI, ptI)];
for(label i=0;i<4;++i) for(label i=0;i<4;++i)
if( smoothVertex_[tet[i]] & BOUNDARY ) if( smoothVertex_[tet[i]] & BOUNDARY )
neiSmoothPoints.appendIfNotIn(tet[i]); neiSmoothPoints.appendIfNotIn(tet[i]);
} }
} }
//- select the point and mark neighbouring BOUNDARY points //- select the point and mark neighbouring BOUNDARY points
selectedPoints.append(nodeI); selectedPoints.append(nodeI);
order[nodeI] = boundaryPointsOrder.size(); order[nodeI] = boundaryPointsOrder.size();
forAll(neiSmoothPoints, i) forAll(neiSmoothPoints, i)
helper[neiSmoothPoints[i]] = true; helper[neiSmoothPoints[i]] = true;
} }
} }
if( selectedPoints.size() != 0 ) if( selectedPoints.size() != 0 )
{ {
boundaryPointsOrder.appendList(selectedPoints); boundaryPointsOrder.appendList(selectedPoints);
found = true; found = true;
} }
} while( found ); } while( found );
} }

View file

@ -40,7 +40,7 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void partTetMesh::createParallelAddressing void partTetMesh::createParallelAddressing
@ -52,27 +52,27 @@ void partTetMesh::createParallelAddressing
{ {
//- vertices marked as SMOOTH and BOUNDARY are used by the smoother //- vertices marked as SMOOTH and BOUNDARY are used by the smoother
const direction useType = SMOOTH + BOUNDARY; const direction useType = SMOOTH + BOUNDARY;
//- allocate global point labels //- allocate global point labels
if( !globalPointLabelPtr_ ) if( !globalPointLabelPtr_ )
globalPointLabelPtr_ = new labelLongList(); globalPointLabelPtr_ = new labelLongList();
labelLongList& globalTetPointLabel = *globalPointLabelPtr_; labelLongList& globalTetPointLabel = *globalPointLabelPtr_;
globalTetPointLabel.setSize(points_.size()); globalTetPointLabel.setSize(points_.size());
globalTetPointLabel = -1; globalTetPointLabel = -1;
//- allocated point-processors addressing //- allocated point-processors addressing
if( !pAtProcsPtr_ ) if( !pAtProcsPtr_ )
pAtProcsPtr_ = new VRWGraph(); pAtProcsPtr_ = new VRWGraph();
VRWGraph& pProcs = *pAtProcsPtr_; VRWGraph& pProcs = *pAtProcsPtr_;
pProcs.setSize(0); pProcs.setSize(0);
pProcs.setSize(points_.size()); pProcs.setSize(points_.size());
//- allocate global-to-local point addressing //- allocate global-to-local point addressing
if( !globalToLocalPointAddressingPtr_ ) if( !globalToLocalPointAddressingPtr_ )
globalToLocalPointAddressingPtr_ = new Map<label>(); globalToLocalPointAddressingPtr_ = new Map<label>();
Map<label>& globalToLocal = *globalToLocalPointAddressingPtr_; Map<label>& globalToLocal = *globalToLocalPointAddressingPtr_;
globalToLocal.clear(); globalToLocal.clear();
//- allocate storage for points at parallel boundaries //- allocate storage for points at parallel boundaries
if( !pAtParallelBoundariesPtr_ ) if( !pAtParallelBoundariesPtr_ )
pAtParallelBoundariesPtr_ = new labelLongList(); pAtParallelBoundariesPtr_ = new labelLongList();
@ -82,23 +82,23 @@ void partTetMesh::createParallelAddressing
//- create point-processors addressing //- create point-processors addressing
std::map<label, labelLongList> exchangeData; std::map<label, labelLongList> exchangeData;
std::map<label, labelLongList>::iterator iter; std::map<label, labelLongList>::iterator iter;
const polyMeshGenAddressing& addressing = origMesh_.addressingData(); const polyMeshGenAddressing& addressing = origMesh_.addressingData();
const Map<label>& globalToLocalPointAddressing = const Map<label>& globalToLocalPointAddressing =
addressing.globalToLocalPointAddressing(); addressing.globalToLocalPointAddressing();
const VRWGraph& pAtProcs = addressing.pointAtProcs(); const VRWGraph& pAtProcs = addressing.pointAtProcs();
const DynList<label>& pNeiProcs = addressing.pointNeiProcs(); const DynList<label>& pNeiProcs = addressing.pointNeiProcs();
forAll(pNeiProcs, procI) forAll(pNeiProcs, procI)
exchangeData.insert(std::make_pair(pNeiProcs[procI], labelLongList())); exchangeData.insert(std::make_pair(pNeiProcs[procI], labelLongList()));
//- make sure that the same vertices are marked for smoothing on all procs //- make sure that the same vertices are marked for smoothing on all procs
//- this is performed by sending the labels of vertices which are not used //- this is performed by sending the labels of vertices which are not used
//- for tet mesh creation and the tet mesh vertices which are not moved //- for tet mesh creation and the tet mesh vertices which are not moved
forAllConstIter(Map<label>, globalToLocalPointAddressing, it) forAllConstIter(Map<label>, globalToLocalPointAddressing, it)
{ {
const label pI = it(); const label pI = it();
if( if(
nodeLabelForPoint[pI] == -1 || nodeLabelForPoint[pI] == -1 ||
!smoothVertex_[nodeLabelForPoint[pI]] !smoothVertex_[nodeLabelForPoint[pI]]
@ -109,12 +109,12 @@ void partTetMesh::createParallelAddressing
const label neiProc = pAtProcs(pI, procI); const label neiProc = pAtProcs(pI, procI);
if( neiProc == Pstream::myProcNo() ) if( neiProc == Pstream::myProcNo() )
continue; continue;
exchangeData[neiProc].append(it.key()); exchangeData[neiProc].append(it.key());
} }
} }
} }
//- exchange data with other processors //- exchange data with other processors
labelLongList receivedData; labelLongList receivedData;
help::exchangeMap(exchangeData, receivedData); help::exchangeMap(exchangeData, receivedData);
@ -123,62 +123,62 @@ void partTetMesh::createParallelAddressing
forAll(receivedData, i) forAll(receivedData, i)
{ {
const label pointI = globalToLocalPointAddressing[receivedData[i]]; const label pointI = globalToLocalPointAddressing[receivedData[i]];
if( nodeLabelForPoint[pointI] == -1 ) if( nodeLabelForPoint[pointI] == -1 )
continue; continue;
smoothVertex_[nodeLabelForPoint[pointI]] = NONE; smoothVertex_[nodeLabelForPoint[pointI]] = NONE;
} }
for(iter=exchangeData.begin();iter!=exchangeData.end();++iter) for(iter=exchangeData.begin();iter!=exchangeData.end();++iter)
iter->second.clear(); iter->second.clear();
//- start creating global-to-local addressing //- start creating global-to-local addressing
//- find the starting point labels //- find the starting point labels
label startPoint(0), nLocalPoints(0), nSharedPoints(0); label startPoint(0), nLocalPoints(0), nSharedPoints(0);
//- count the number of points at processor boundaries //- count the number of points at processor boundaries
forAllConstIter(Map<label>, globalToLocalPointAddressing, it) forAllConstIter(Map<label>, globalToLocalPointAddressing, it)
{ {
const label pI = it(); const label pI = it();
if( nodeLabelForPoint[pI] == -1 ) if( nodeLabelForPoint[pI] == -1 )
continue; continue;
if( !(smoothVertex_[nodeLabelForPoint[pI]] & useType) ) if( !(smoothVertex_[nodeLabelForPoint[pI]] & useType) )
continue; continue;
++nSharedPoints; ++nSharedPoints;
label pMin(Pstream::myProcNo()); label pMin(Pstream::myProcNo());
forAllRow(pAtProcs, pI, procI) forAllRow(pAtProcs, pI, procI)
pMin = Foam::min(pMin, pAtProcs(pI, procI)); pMin = Foam::min(pMin, pAtProcs(pI, procI));
if( pMin == Pstream::myProcNo() ) if( pMin == Pstream::myProcNo() )
++nLocalPoints; ++nLocalPoints;
} }
labelList nPointsAtProc(Pstream::nProcs()); labelList nPointsAtProc(Pstream::nProcs());
nSharedPoints -= nLocalPoints; nSharedPoints -= nLocalPoints;
nPointsAtProc[Pstream::myProcNo()] = points_.size() - nSharedPoints; nPointsAtProc[Pstream::myProcNo()] = points_.size() - nSharedPoints;
Pstream::gatherList(nPointsAtProc); Pstream::gatherList(nPointsAtProc);
Pstream::scatterList(nPointsAtProc); Pstream::scatterList(nPointsAtProc);
for(label i=0;i<Pstream::myProcNo();++i) for(label i=0;i<Pstream::myProcNo();++i)
startPoint += nPointsAtProc[i]; startPoint += nPointsAtProc[i];
//- create global labels for points at processor boundaries //- create global labels for points at processor boundaries
forAllConstIter(Map<label>, globalToLocalPointAddressing, it) forAllConstIter(Map<label>, globalToLocalPointAddressing, it)
{ {
const label pI = it(); const label pI = it();
if( nodeLabelForPoint[pI] == -1 ) if( nodeLabelForPoint[pI] == -1 )
continue; continue;
const label pLabel = nodeLabelForPoint[pI]; const label pLabel = nodeLabelForPoint[pI];
if( !(smoothVertex_[pLabel] & useType) ) if( !(smoothVertex_[pLabel] & useType) )
continue; continue;
label pMin(Pstream::myProcNo()); label pMin(Pstream::myProcNo());
forAllRow(pAtProcs, pI, procI) forAllRow(pAtProcs, pI, procI)
{ {
@ -186,19 +186,19 @@ void partTetMesh::createParallelAddressing
pProcs.append(pLabel, neiProc); pProcs.append(pLabel, neiProc);
pMin = Foam::min(pMin, neiProc); pMin = Foam::min(pMin, neiProc);
} }
if( pMin != Pstream::myProcNo() ) if( pMin != Pstream::myProcNo() )
continue; continue;
globalTetPointLabel[pLabel] = startPoint++; globalTetPointLabel[pLabel] = startPoint++;
forAllRow(pAtProcs, pI, procI) forAllRow(pAtProcs, pI, procI)
{ {
const label neiProc = pAtProcs(pI, procI); const label neiProc = pAtProcs(pI, procI);
if( neiProc == Pstream::myProcNo() ) if( neiProc == Pstream::myProcNo() )
continue; continue;
//- the following information is sent to other processor //- the following information is sent to other processor
//- 1. global point label in the original mesh //- 1. global point label in the original mesh
//- 2. global point label in the tet mesh //- 2. global point label in the tet mesh
@ -210,7 +210,7 @@ void partTetMesh::createParallelAddressing
//- exchange data with other processors //- exchange data with other processors
receivedData.clear(); receivedData.clear();
help::exchangeMap(exchangeData, receivedData); help::exchangeMap(exchangeData, receivedData);
label counter(0); label counter(0);
while( counter < receivedData.size() ) while( counter < receivedData.size() )
{ {
@ -218,17 +218,17 @@ void partTetMesh::createParallelAddressing
const label tgI = receivedData[counter++]; const label tgI = receivedData[counter++];
const label pLabel = const label pLabel =
nodeLabelForPoint[globalToLocalPointAddressing[gpI]]; nodeLabelForPoint[globalToLocalPointAddressing[gpI]];
globalTetPointLabel[pLabel] = tgI; globalTetPointLabel[pLabel] = tgI;
} }
//- set global labels for remaining points //- set global labels for remaining points
forAll(globalTetPointLabel, pI) forAll(globalTetPointLabel, pI)
{ {
if( globalTetPointLabel[pI] == -1 ) if( globalTetPointLabel[pI] == -1 )
globalTetPointLabel[pI] = startPoint++; globalTetPointLabel[pI] = startPoint++;
} }
//- create global to local mapping //- create global to local mapping
forAll(globalTetPointLabel, pI) forAll(globalTetPointLabel, pI)
{ {
@ -238,20 +238,20 @@ void partTetMesh::createParallelAddressing
globalToLocal.insert(globalTetPointLabel[pI], pI); globalToLocal.insert(globalTetPointLabel[pI], pI);
} }
} }
//- mark vertices at parallel boundaries //- mark vertices at parallel boundaries
forAll(smoothVertex_, pI) forAll(smoothVertex_, pI)
if( (smoothVertex_[pI] & useType) && (pProcs.sizeOfRow(pI) != 0) ) if( (smoothVertex_[pI] & useType) && (pProcs.sizeOfRow(pI) != 0) )
smoothVertex_[pI] |= PARALLELBOUNDARY; smoothVertex_[pI] |= PARALLELBOUNDARY;
//- create neighbour processors addressing //- create neighbour processors addressing
if( !neiProcsPtr_ ) if( !neiProcsPtr_ )
neiProcsPtr_ = new DynList<label>(); neiProcsPtr_ = new DynList<label>();
DynList<label>& neiProcs = *neiProcsPtr_; DynList<label>& neiProcs = *neiProcsPtr_;
for(iter=exchangeData.begin();iter!=exchangeData.end();++iter) for(iter=exchangeData.begin();iter!=exchangeData.end();++iter)
neiProcs.append(iter->first); neiProcs.append(iter->first);
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
for(label i=0;i<Pstream::nProcs();++i) for(label i=0;i<Pstream::nProcs();++i)
{ {
@ -259,21 +259,21 @@ void partTetMesh::createParallelAddressing
{ {
Pout << "globalTetPointLabel " << globalTetPointLabel << endl; Pout << "globalTetPointLabel " << globalTetPointLabel << endl;
} }
returnReduce(i, sumOp<label>()); returnReduce(i, sumOp<label>());
} }
returnReduce(1, sumOp<label>()); returnReduce(1, sumOp<label>());
forAll(nodeLabelForPoint, pI) forAll(nodeLabelForPoint, pI)
{ {
const label tpI = nodeLabelForPoint[pI]; const label tpI = nodeLabelForPoint[pI];
if( tpI != -1 && globalTetPointLabel[tpI] == -1 ) if( tpI != -1 && globalTetPointLabel[tpI] == -1 )
FatalError << "Crap1 " << tpI << abort(FatalError); FatalError << "Crap1 " << tpI << abort(FatalError);
} }
returnReduce(1, sumOp<label>()); returnReduce(1, sumOp<label>());
forAll(nodeLabelForFace, fI) forAll(nodeLabelForFace, fI)
{ {
const label tpI = nodeLabelForFace[fI]; const label tpI = nodeLabelForFace[fI];
@ -284,33 +284,33 @@ void partTetMesh::createParallelAddressing
FatalError << "Crap2" << tpI << abort(FatalError); FatalError << "Crap2" << tpI << abort(FatalError);
} }
} }
returnReduce(1, sumOp<label>()); returnReduce(1, sumOp<label>());
forAll(nodeLabelForCell, cI) forAll(nodeLabelForCell, cI)
{ {
const label tpI = nodeLabelForCell[cI]; const label tpI = nodeLabelForCell[cI];
if( tpI != -1 && globalTetPointLabel[tpI] == -1 ) if( tpI != -1 && globalTetPointLabel[tpI] == -1 )
FatalError << "Crap3" << tpI << abort(FatalError); FatalError << "Crap3" << tpI << abort(FatalError);
} }
forAll(smoothVertex_, vI) forAll(smoothVertex_, vI)
if( smoothVertex_[vI] & partTetMesh::PARALLELBOUNDARY ) if( smoothVertex_[vI] & partTetMesh::PARALLELBOUNDARY )
Pout << "Point " << globalTetPointLabel[vI] Pout << "Point " << globalTetPointLabel[vI]
<< " is at par bnd" << endl; << " is at par bnd" << endl;
Serr << Pstream::myProcNo() << "points " << points_ << endl; Serr << Pstream::myProcNo() << "points " << points_ << endl;
Serr << Pstream::myProcNo() << "Tets " << tets_ << endl; Serr << Pstream::myProcNo() << "Tets " << tets_ << endl;
forAll(pProcs, pI) forAll(pProcs, pI)
{ {
if( pProcs.sizeOfRow(pI) == 0 ) if( pProcs.sizeOfRow(pI) == 0 )
continue; continue;
Serr << Pstream::myProcNo() << "Point " << globalTetPointLabel[pI] Serr << Pstream::myProcNo() << "Point " << globalTetPointLabel[pI]
<< " is at procs " << pProcs[pI] << " n tets " << " is at procs " << pProcs[pI] << " n tets "
<< pointTets_[pI].size() << endl; << pointTets_[pI].size() << endl;
} }
returnReduce(1, sumOp<label>()); returnReduce(1, sumOp<label>());
# endif # endif
} }
@ -321,12 +321,12 @@ void partTetMesh::createBufferLayers()
labelLongList& globalTetPointLabel = *globalPointLabelPtr_; labelLongList& globalTetPointLabel = *globalPointLabelPtr_;
Map<label>& globalToLocal = *globalToLocalPointAddressingPtr_; Map<label>& globalToLocal = *globalToLocalPointAddressingPtr_;
const DynList<label>& neiProcs = *this->neiProcsPtr_; const DynList<label>& neiProcs = *this->neiProcsPtr_;
if( !pAtBufferLayersPtr_ ) if( !pAtBufferLayersPtr_ )
pAtBufferLayersPtr_ = new labelLongList(); pAtBufferLayersPtr_ = new labelLongList();
labelLongList& pAtBufferLayers = *pAtBufferLayersPtr_; labelLongList& pAtBufferLayers = *pAtBufferLayersPtr_;
pAtBufferLayers.clear(); pAtBufferLayers.clear();
//- create the map //- create the map
std::map<label, LongList<parPartTet> > exchangeTets; std::map<label, LongList<parPartTet> > exchangeTets;
forAll(neiProcs, procI) forAll(neiProcs, procI)
@ -334,32 +334,32 @@ void partTetMesh::createBufferLayers()
( (
std::make_pair(neiProcs[procI], LongList<parPartTet>()) std::make_pair(neiProcs[procI], LongList<parPartTet>())
); );
//- go through the tets and add the ones having vertices at parallel //- go through the tets and add the ones having vertices at parallel
//- boundaries for sending //- boundaries for sending
forAll(tets_, tetI) forAll(tets_, tetI)
{ {
const partTet& pt = tets_[tetI]; const partTet& pt = tets_[tetI];
DynList<label> sendToProcs; DynList<label> sendToProcs;
forAll(pt, i) forAll(pt, i)
{ {
const label pLabel = pt[i]; const label pLabel = pt[i];
if( smoothVertex_[pLabel] & PARALLELBOUNDARY ) if( smoothVertex_[pLabel] & PARALLELBOUNDARY )
{ {
forAllRow(pProcs, pLabel, i) forAllRow(pProcs, pLabel, i)
{ {
const label neiProc = pProcs(pLabel, i); const label neiProc = pProcs(pLabel, i);
if( neiProc == Pstream::myProcNo() ) if( neiProc == Pstream::myProcNo() )
continue; continue;
sendToProcs.appendIfNotIn(neiProc); sendToProcs.appendIfNotIn(neiProc);
} }
} }
} }
if( sendToProcs.size() ) if( sendToProcs.size() )
{ {
const parPartTet tet const parPartTet tet
@ -369,36 +369,36 @@ void partTetMesh::createBufferLayers()
labelledPoint(globalTetPointLabel[pt[2]], points_[pt[2]]), labelledPoint(globalTetPointLabel[pt[2]], points_[pt[2]]),
labelledPoint(globalTetPointLabel[pt[3]], points_[pt[3]]) labelledPoint(globalTetPointLabel[pt[3]], points_[pt[3]])
); );
forAll(sendToProcs, i) forAll(sendToProcs, i)
{ {
exchangeTets[sendToProcs[i]].append(tet); exchangeTets[sendToProcs[i]].append(tet);
forAll(pt, j) forAll(pt, j)
{ {
if( pProcs.sizeOfRow(pt[j]) == 0 ) if( pProcs.sizeOfRow(pt[j]) == 0 )
pAtBufferLayers.append(pt[j]); pAtBufferLayers.append(pt[j]);
pProcs.appendIfNotIn(pt[j], sendToProcs[i]); pProcs.appendIfNotIn(pt[j], sendToProcs[i]);
} }
} }
} }
} }
LongList<parPartTet> receivedTets; LongList<parPartTet> receivedTets;
help::exchangeMap(exchangeTets, receivedTets); help::exchangeMap(exchangeTets, receivedTets);
exchangeTets.clear(); exchangeTets.clear();
Map<label> newGlobalToLocal; Map<label> newGlobalToLocal;
forAll(receivedTets, i) forAll(receivedTets, i)
{ {
const parPartTet& tet = receivedTets[i]; const parPartTet& tet = receivedTets[i];
DynList<label> tetPointLabels; DynList<label> tetPointLabels;
for(label j=0;j<4;++j) for(label j=0;j<4;++j)
{ {
const label gpI = tet[j].pointLabel(); const label gpI = tet[j].pointLabel();
if( globalToLocal.found(gpI) ) if( globalToLocal.found(gpI) )
{ {
const label pI = globalToLocal[gpI]; const label pI = globalToLocal[gpI];
@ -419,13 +419,13 @@ void partTetMesh::createBufferLayers()
DynList<label> helper; DynList<label> helper;
helper.append(tets_.size()); helper.append(tets_.size());
pointTets_.appendList(helper); pointTets_.appendList(helper);
globalTetPointLabel.append(gpI); globalTetPointLabel.append(gpI);
helper[0] = Pstream::myProcNo(); helper[0] = Pstream::myProcNo();
pProcs.appendList(helper); pProcs.appendList(helper);
} }
} }
//- append tet //- append tet
tets_.append tets_.append
( (
@ -438,7 +438,7 @@ void partTetMesh::createBufferLayers()
) )
); );
} }
//- insert the global labels of the buffer points //- insert the global labels of the buffer points
//- into the globalToLocal map //- into the globalToLocal map
forAllConstIter(Map<label>, newGlobalToLocal, it) forAllConstIter(Map<label>, newGlobalToLocal, it)
@ -455,13 +455,13 @@ void partTetMesh::createBufferLayers()
if( it() < pProcs.size() ) if( it() < pProcs.size() )
forAllRow(pProcs, it(), j) forAllRow(pProcs, it(), j)
np.append(pProcs(it(), j)); np.append(pProcs(it(), j));
Pout << "Tet mesh point " << it() << " has global label " Pout << "Tet mesh point " << it() << " has global label "
<< it.key() << " and is located at procs " << it.key() << " and is located at procs "
<< np << endl; << np << endl;
} }
} }
returnReduce(1, sumOp<label>()); returnReduce(1, sumOp<label>());
} }
# endif # endif

View file

@ -49,7 +49,7 @@ partTetMeshSimplex::partTetMeshSimplex
const LongList<point>& points = tm.points(); const LongList<point>& points = tm.points();
const LongList<partTet>& tets = tm.tets(); const LongList<partTet>& tets = tm.tets();
const VRWGraph& pt = tm.pointTets(); const VRWGraph& pt = tm.pointTets();
tets_.setSize(pt.sizeOfRow(pI)); tets_.setSize(pt.sizeOfRow(pI));
label counter(0); label counter(0);
@ -67,11 +67,11 @@ partTetMeshSimplex::partTetMeshSimplex
++counter; ++counter;
} }
} }
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "Tet " << tetI << " is " << tet << endl; Info << "Tet " << tetI << " is " << tet << endl;
# endif # endif
const label pos = tet.whichPosition(pI); const label pos = tet.whichPosition(pI);
switch( pos ) switch( pos )
{ {
@ -143,12 +143,12 @@ partTetMeshSimplex::partTetMeshSimplex
{ {
tets_.setSize(pt.size()); tets_.setSize(pt.size());
label pI(0); label pI(0);
Map<label> addr; Map<label> addr;
forAll(pt, tetI) forAll(pt, tetI)
{ {
const parPartTet& tet = pt[tetI]; const parPartTet& tet = pt[tetI];
label pos(-1); label pos(-1);
for(label i=0;i<4;++i) for(label i=0;i<4;++i)
{ {
@ -158,11 +158,11 @@ partTetMeshSimplex::partTetMeshSimplex
pts_.append(tet[i].coordinates()); pts_.append(tet[i].coordinates());
++pI; ++pI;
} }
if( tet[i].pointLabel() == gpI ) if( tet[i].pointLabel() == gpI )
pos = i; pos = i;
} }
switch( pos ) switch( pos )
{ {
case 0: case 0:
@ -223,7 +223,7 @@ partTetMeshSimplex::partTetMeshSimplex
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
partTetMeshSimplex::~partTetMeshSimplex() partTetMeshSimplex::~partTetMeshSimplex()
{} {}

View file

@ -26,9 +26,9 @@ Class
Description Description
A simplex which is used for smoothing purposes A simplex which is used for smoothing purposes
SourceFiles SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -42,7 +42,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward declarations
class partTetMesh; class partTetMesh;
@ -55,45 +55,45 @@ class partTetMeshSimplex
// Private data // Private data
//- points making the simplex //- points making the simplex
DynList<point, 128> pts_; DynList<point, 128> pts_;
//- tets making the simplex //- tets making the simplex
DynList<partTet, 128> tets_; DynList<partTet, 128> tets_;
public: public:
// Constructors // Constructors
//- Construct from partTetMeshSimplex and point label //- Construct from partTetMeshSimplex and point label
partTetMeshSimplex(const partTetMesh& tm, const label pI); partTetMeshSimplex(const partTetMesh& tm, const label pI);
//- Construct from the list of parPartTet and point label //- Construct from the list of parPartTet and point label
partTetMeshSimplex partTetMeshSimplex
( (
const DynList<parPartTet>& pt, const DynList<parPartTet>& pt,
const label gpI const label gpI
); );
// Destructor // Destructor
~partTetMeshSimplex(); ~partTetMeshSimplex();
// Member functions // Member functions
//- return points //- return points
inline DynList<point, 128>& pts() inline DynList<point, 128>& pts()
{ {
return pts_; return pts_;
} }
//- return points //- return points
inline const DynList<point, 128>& pts() const inline const DynList<point, 128>& pts() const
{ {
return pts_; return pts_;
} }
//- return tets //- return tets
inline const DynList<partTet, 128>& tets() const inline const DynList<partTet, 128>& tets() const
{ {
return tets_; return tets_;
} }
//- return centre point coordinates //- return centre point coordinates
inline const point& centrePoint() const inline const point& centrePoint() const
{ {

View file

@ -37,9 +37,9 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void partTriMesh::createPointsAndTrias void partTriMesh::createPointsAndTrias
( (
const List<direction>& useFace const List<direction>& useFace
@ -52,7 +52,7 @@ void partTriMesh::createPointsAndTrias
const labelList& bPoints = meshSurface.boundaryPoints(); const labelList& bPoints = meshSurface.boundaryPoints();
const labelList& bp = meshSurface.bp(); const labelList& bp = meshSurface.bp();
const faceList::subList& bFaces = meshSurface.boundaryFaces(); const faceList::subList& bFaces = meshSurface.boundaryFaces();
meshSurfacePointLabelInTriMesh_.setSize(bPoints.size()); meshSurfacePointLabelInTriMesh_.setSize(bPoints.size());
meshSurfacePointLabelInTriMesh_ = -1; meshSurfacePointLabelInTriMesh_ = -1;
labelList nodeLabelForFace(bFaces.size(), -1); labelList nodeLabelForFace(bFaces.size(), -1);
@ -128,7 +128,7 @@ void partTriMesh::createPointsAndTrias
pts[npI] = points[bPoints[bpI]]; pts[npI] = points[bPoints[bpI]];
pointType_[npI] |= SMOOTH; pointType_[npI] |= SMOOTH;
} }
forAll(nodeLabelForFace, bfI) forAll(nodeLabelForFace, bfI)
if( nodeLabelForFace[bfI] != -1 ) if( nodeLabelForFace[bfI] != -1 )
{ {
@ -148,7 +148,7 @@ void partTriMesh::createPointsAndTrias
if( pI != -1 ) if( pI != -1 )
pointType_[pI] |= FEATUREEDGE; pointType_[pI] |= FEATUREEDGE;
} }
//- create addressing for parallel runs //- create addressing for parallel runs
if( Pstream::parRun() ) if( Pstream::parRun() )
{ {
@ -157,7 +157,7 @@ void partTriMesh::createPointsAndTrias
meshSurfacePointLabelInTriMesh_, meshSurfacePointLabelInTriMesh_,
nodeLabelForFace nodeLabelForFace
); );
createBufferLayers(); createBufferLayers();
} }
} }

View file

@ -49,7 +49,7 @@ partTriMeshSimplex::partTriMeshSimplex
const pointField& points = tm.points(); const pointField& points = tm.points();
const LongList<labelledTri>& trias = tm.triangles(); const LongList<labelledTri>& trias = tm.triangles();
const VRWGraph& pt = tm.pointTriangles(); const VRWGraph& pt = tm.pointTriangles();
trias_.setSize(pt.sizeOfRow(pI)); trias_.setSize(pt.sizeOfRow(pI));
label counter(0); label counter(0);
@ -68,11 +68,11 @@ partTriMeshSimplex::partTriMeshSimplex
++counter; ++counter;
} }
} }
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "Tet " << tetI << " is " << tet << endl; Info << "Tet " << tetI << " is " << tet << endl;
# endif # endif
label pos(-1); label pos(-1);
for(label i=0;i<3;++i) for(label i=0;i<3;++i)
if( tri[i] == pI ) if( tri[i] == pI )
@ -109,7 +109,7 @@ partTriMeshSimplex::partTriMeshSimplex
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
partTriMeshSimplex::~partTriMeshSimplex() partTriMeshSimplex::~partTriMeshSimplex()
{} {}

View file

@ -26,9 +26,9 @@ Class
Description Description
A simplex which is used for smoothing purposes A simplex which is used for smoothing purposes
SourceFiles SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -42,7 +42,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward declarations
class partTriMesh; class partTriMesh;
@ -55,38 +55,38 @@ class partTriMeshSimplex
// Private data // Private data
//- points making the simplex //- points making the simplex
DynList<point, 32> pts_; DynList<point, 32> pts_;
//- triangles making the simplex //- triangles making the simplex
DynList<triFace, 32> trias_; DynList<triFace, 32> trias_;
public: public:
// Constructors // Constructors
//- Construct from partTriMesh and point label //- Construct from partTriMesh and point label
partTriMeshSimplex(const partTriMesh& tm, const label pI); partTriMeshSimplex(const partTriMesh& tm, const label pI);
// Destructor // Destructor
~partTriMeshSimplex(); ~partTriMeshSimplex();
// Member functions // Member functions
//- return points //- return points
inline DynList<point, 32>& pts() inline DynList<point, 32>& pts()
{ {
return pts_; return pts_;
} }
//- return points //- return points
inline const DynList<point, 32>& pts() const inline const DynList<point, 32>& pts() const
{ {
return pts_; return pts_;
} }
//- return triangles //- return triangles
inline const DynList<triFace, 32>& triangles() const inline const DynList<triFace, 32>& triangles() const
{ {
return trias_; return trias_;
} }
//- return centre point coordinates //- return centre point coordinates
inline const point& centrePoint() const inline const point& centrePoint() const
{ {

View file

@ -43,7 +43,7 @@ defineTemplateTypeNameAndDebugWithName
"polyBoundaryMesh", "polyBoundaryMesh",
0 0
); );
defineTypeNameAndDebug(boundaryPatchBase, 0); defineTypeNameAndDebug(boundaryPatchBase, 0);
defineRunTimeSelectionTable(boundaryPatchBase, dictionary); defineRunTimeSelectionTable(boundaryPatchBase, dictionary);
@ -60,7 +60,7 @@ autoPtr<boundaryPatchBase> boundaryPatchBase::New
//- Other patch types are treated as ordinary patches //- Other patch types are treated as ordinary patches
if( type != "processor" ) if( type != "processor" )
type = "patch"; type = "patch";
dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(type); dictionaryConstructorTablePtr_->find(type);
@ -76,7 +76,7 @@ autoPtr<boundaryPatchBase> boundaryPatchBase::New
<< dictionaryConstructorTablePtr_->toc() << dictionaryConstructorTablePtr_->toc()
<< exit(FatalIOError); << exit(FatalIOError);
} }
return autoPtr<boundaryPatchBase>(cstrIter()(name, dict)); return autoPtr<boundaryPatchBase>(cstrIter()(name, dict));
} }
@ -90,7 +90,7 @@ autoPtr<boundaryPatchBase> boundaryPatchBase::New
return boundaryPatchBase::New(name, dict); return boundaryPatchBase::New(name, dict);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
boundaryPatchBase::boundaryPatchBase boundaryPatchBase::boundaryPatchBase
@ -106,7 +106,7 @@ boundaryPatchBase::boundaryPatchBase
nFaces_(nF), nFaces_(nF),
startFace_(sF) startFace_(sF)
{} {}
boundaryPatchBase::boundaryPatchBase(const word& name, const dictionary& dict) boundaryPatchBase::boundaryPatchBase(const word& name, const dictionary& dict)
: :
name_(name), name_(name),

View file

@ -51,23 +51,23 @@ namespace Foam
class boundaryPatchBase class boundaryPatchBase
{ {
protected: protected:
// Protected data // Protected data
word name_; word name_;
word type_; word type_;
label nFaces_; label nFaces_;
label startFace_; label startFace_;
public: public:
//- Runtime type information //- Runtime type information
TypeName("boundaryPatchBase"); TypeName("boundaryPatchBase");
// Constructors // Constructors
boundaryPatchBase boundaryPatchBase
( (
const word&, const word&,
@ -84,7 +84,7 @@ public:
{} {}
// Declare run-time constructor selection table // Declare run-time constructor selection table
declareRunTimeSelectionTable declareRunTimeSelectionTable
( (
autoPtr, autoPtr,
@ -98,20 +98,20 @@ public:
); );
// Selectors // Selectors
static autoPtr<boundaryPatchBase> New static autoPtr<boundaryPatchBase> New
( (
const word& name, const word& name,
const dictionary& dict const dictionary& dict
); );
static autoPtr<boundaryPatchBase> New static autoPtr<boundaryPatchBase> New
( (
Istream& Istream&
); );
// Construct and return a clone // Construct and return a clone
autoPtr<boundaryPatchBase> clone() const autoPtr<boundaryPatchBase> clone() const
{ {
return New return New
@ -120,7 +120,7 @@ public:
this->dict() this->dict()
); );
} }
//- Write //- Write
virtual void write(Ostream&) const = 0; virtual void write(Ostream&) const = 0;
@ -133,45 +133,45 @@ public:
{ {
return name_; return name_;
} }
inline word& patchName() inline word& patchName()
{ {
return name_; return name_;
} }
inline const word& patchType() const inline const word& patchType() const
{ {
return type_; return type_;
} }
inline word& patchType() inline word& patchType()
{ {
return type_; return type_;
} }
inline label patchStart() const inline label patchStart() const
{ {
return startFace_; return startFace_;
} }
inline label& patchStart() inline label& patchStart()
{ {
return startFace_; return startFace_;
} }
inline label patchSize() const inline label patchSize() const
{ {
return nFaces_; return nFaces_;
} }
inline label& patchSize() inline label& patchSize()
{ {
return nFaces_; return nFaces_;
} }
//- Return as dictionary of entries //- Return as dictionary of entries
virtual dictionary dict() const = 0; virtual dictionary dict() const = 0;
// Member operators // Member operators
friend Ostream& operator<<(Ostream&, const boundaryPatchBase&); friend Ostream& operator<<(Ostream&, const boundaryPatchBase&);
virtual Istream& operator>>(Istream&) = 0; virtual Istream& operator>>(Istream&) = 0;

View file

@ -39,7 +39,7 @@ namespace Foam
defineTypeNameAndDebug(processorBoundaryPatch, 0); defineTypeNameAndDebug(processorBoundaryPatch, 0);
addToRunTimeSelectionTable(boundaryPatchBase, processorBoundaryPatch, dictionary); addToRunTimeSelectionTable(boundaryPatchBase, processorBoundaryPatch, dictionary);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
processorBoundaryPatch::processorBoundaryPatch processorBoundaryPatch::processorBoundaryPatch
@ -56,7 +56,7 @@ processorBoundaryPatch::processorBoundaryPatch
myProcNo_(myProcNo), myProcNo_(myProcNo),
neighbProcNo_(neighbProcNo) neighbProcNo_(neighbProcNo)
{} {}
processorBoundaryPatch::processorBoundaryPatch processorBoundaryPatch::processorBoundaryPatch
( (
const word& name, const word& name,
@ -67,10 +67,10 @@ processorBoundaryPatch::processorBoundaryPatch
myProcNo_(readLabel(dict.lookup("myProcNo"))), myProcNo_(readLabel(dict.lookup("myProcNo"))),
neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))) neighbProcNo_(readLabel(dict.lookup("neighbProcNo")))
{ {
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionary processorBoundaryPatch::dict() const dictionary processorBoundaryPatch::dict() const
{ {
dictionary dict; dictionary dict;
@ -92,7 +92,7 @@ void processorBoundaryPatch::write(Ostream& os) const
void processorBoundaryPatch::writeDict(Ostream& os) const void processorBoundaryPatch::writeDict(Ostream& os) const
{ {
} }
Ostream& processorBoundaryPatch::operator<<(Ostream& os) const Ostream& processorBoundaryPatch::operator<<(Ostream& os) const

View file

@ -52,7 +52,7 @@ class polyMeshGen
dictionary metaDict_; dictionary metaDict_;
public: public:
// Constructors // Constructors
//- Null constructor //- Null constructor
polyMeshGen(const Time& t); polyMeshGen(const Time& t);
@ -77,7 +77,7 @@ public:
const labelList& patchStart, const labelList& patchStart,
const labelList& nFacesInPatch const labelList& nFacesInPatch
); );
// Destructor // Destructor
~polyMeshGen(); ~polyMeshGen();
@ -97,13 +97,13 @@ public:
// Read mesh // Read mesh
void read(); void read();
// Write mesh // Write mesh
void write() const; void write() const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -39,12 +39,12 @@ namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const faceListPMG& polyMeshGenFaces::faces() const inline const faceListPMG& polyMeshGenFaces::faces() const
{ {
return faces_; return faces_;
} }
inline label polyMeshGenFaces::nInternalFaces() const inline label polyMeshGenFaces::nInternalFaces() const
{ {
if( !(ownerPtr_ && neighbourPtr_) ) if( !(ownerPtr_ && neighbourPtr_) )
@ -79,7 +79,7 @@ inline const labelList& polyMeshGenFaces::owner() const
calculateOwnersAndNeighbours(); calculateOwnersAndNeighbours();
} }
return *ownerPtr_; return *ownerPtr_;
} }
@ -98,7 +98,7 @@ inline const labelList& polyMeshGenFaces::neighbour() const
calculateOwnersAndNeighbours(); calculateOwnersAndNeighbours();
} }
return *neighbourPtr_; return *neighbourPtr_;
} }
@ -122,7 +122,7 @@ inline void polyMeshGenFaces::addFaceToSubset
std::map<label, meshSubset>::iterator it = faceSubsets_.find(setID); std::map<label, meshSubset>::iterator it = faceSubsets_.find(setID);
if( it == faceSubsets_.end() ) if( it == faceSubsets_.end() )
return; return;
it->second.addElement(faceI); it->second.addElement(faceI);
} }
@ -134,7 +134,7 @@ inline void polyMeshGenFaces::removeFaceFromSubset
std::map<label, meshSubset>::iterator it = faceSubsets_.find(setI); std::map<label, meshSubset>::iterator it = faceSubsets_.find(setI);
if( it == faceSubsets_.end() ) if( it == faceSubsets_.end() )
return; return;
it->second.removeElement(faceI); it->second.removeElement(faceI);
} }
@ -145,7 +145,7 @@ inline void polyMeshGenFaces::faceInSubsets
) const ) const
{ {
faceSubsets.clear(); faceSubsets.clear();
std::map<label, meshSubset>::const_iterator it; std::map<label, meshSubset>::const_iterator it;
for for
( (
@ -162,7 +162,7 @@ inline void polyMeshGenFaces::faceInSubsets
inline void polyMeshGenFaces::faceSubsetIndices(DynList<label>& indices) const inline void polyMeshGenFaces::faceSubsetIndices(DynList<label>& indices) const
{ {
indices.clear(); indices.clear();
std::map<label, meshSubset>::const_iterator it; std::map<label, meshSubset>::const_iterator it;
for for
( (
@ -181,12 +181,12 @@ inline void polyMeshGenFaces::facesInSubset
) const ) const
{ {
faceLabels.clear(); faceLabels.clear();
std::map<label, meshSubset>::const_iterator it = std::map<label, meshSubset>::const_iterator it =
faceSubsets_.find(setI); faceSubsets_.find(setI);
if( it == faceSubsets_.end() ) if( it == faceSubsets_.end() )
return; return;
it->second.containedElements(faceLabels); it->second.containedElements(faceLabels);
} }

View file

@ -76,7 +76,7 @@ polyMeshGenPoints::polyMeshGenPoints
pointSubsets_() pointSubsets_()
{ {
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Destructor // Destructor
polyMeshGenPoints::~polyMeshGenPoints() polyMeshGenPoints::~polyMeshGenPoints()
@ -93,12 +93,12 @@ label polyMeshGenPoints::addPointSubset(const word& subsetName)
Warning << "Point subset " << subsetName << " already exists!" << endl; Warning << "Point subset " << subsetName << " already exists!" << endl;
return id; return id;
} }
id = 0; id = 0;
std::map<label, meshSubset>::const_iterator it; std::map<label, meshSubset>::const_iterator it;
for(it=pointSubsets_.begin();it!=pointSubsets_.end();++it) for(it=pointSubsets_.begin();it!=pointSubsets_.end();++it)
id = Foam::max(id, it->first+1); id = Foam::max(id, it->first+1);
pointSubsets_.insert pointSubsets_.insert
( (
std::make_pair std::make_pair
@ -107,7 +107,7 @@ label polyMeshGenPoints::addPointSubset(const word& subsetName)
meshSubset(subsetName, meshSubset::POINTSUBSET) meshSubset(subsetName, meshSubset::POINTSUBSET)
) )
); );
return id; return id;
} }
@ -115,7 +115,7 @@ void polyMeshGenPoints::removePointSubset(const label subsetID)
{ {
if( pointSubsets_.find(subsetID) == pointSubsets_.end() ) if( pointSubsets_.find(subsetID) == pointSubsets_.end() )
return; return;
pointSubsets_.erase(subsetID); pointSubsets_.erase(subsetID);
} }
@ -128,7 +128,7 @@ word polyMeshGenPoints::pointSubsetName(const label subsetID) const
Warning << "Subset " << subsetID << " is not a point subset" << endl; Warning << "Subset " << subsetID << " is not a point subset" << endl;
return word(); return word();
} }
return it->second.name(); return it->second.name();
} }
@ -140,7 +140,7 @@ label polyMeshGenPoints::pointSubsetIndex(const word& subsetName) const
if( it->second.name() == subsetName ) if( it->second.name() == subsetName )
return it->first; return it->first;
} }
return -1; return -1;
} }
@ -158,7 +158,7 @@ void polyMeshGenPoints::read()
) )
); );
points_ = pts; points_ = pts;
//- read point subsets //- read point subsets
IOobjectList allSets IOobjectList allSets
( (
@ -166,12 +166,12 @@ void polyMeshGenPoints::read()
runTime_.constant(), runTime_.constant(),
"polyMesh/sets" "polyMesh/sets"
); );
wordList setNames = allSets.names("pointSet"); wordList setNames = allSets.names("pointSet");
forAll(setNames, setI) forAll(setNames, setI)
{ {
IOobject* obj = allSets.lookup(setNames[setI]); IOobject* obj = allSets.lookup(setNames[setI]);
pointSet pSet(*obj); pointSet pSet(*obj);
labelList content = pSet.toc(); labelList content = pSet.toc();
const label id = addPointSubset(setNames[setI]); const label id = addPointSubset(setNames[setI]);
@ -183,10 +183,10 @@ void polyMeshGenPoints::read()
void polyMeshGenPoints::write() const void polyMeshGenPoints::write() const
{ {
points_.write(); points_.write();
std::map<label, meshSubset>::const_iterator setIt; std::map<label, meshSubset>::const_iterator setIt;
labelLongList containedElements; labelLongList containedElements;
//- write point selections //- write point selections
for(setIt=pointSubsets_.begin();setIt!=pointSubsets_.end();++setIt) for(setIt=pointSubsets_.begin();setIt!=pointSubsets_.end();++setIt)
{ {
@ -202,9 +202,9 @@ void polyMeshGenPoints::write() const
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
) )
); );
setIt->second.containedElements(containedElements); setIt->second.containedElements(containedElements);
forAll(containedElements, i) forAll(containedElements, i)
set.insert(containedElements[i]); set.insert(containedElements[i]);
set.write(); set.write();

View file

@ -53,7 +53,7 @@ namespace Foam
class polyMeshGenPoints class polyMeshGenPoints
{ {
protected: protected:
// Protected data // Protected data
//- reference to the Time registry //- reference to the Time registry
const Time& runTime_; const Time& runTime_;
@ -63,14 +63,14 @@ protected:
//- map of point subsets //- map of point subsets
std::map<label, meshSubset> pointSubsets_; std::map<label, meshSubset> pointSubsets_;
// Disallow bitwise assignment // Disallow bitwise assignment
void operator=(const polyMeshGenPoints&); void operator=(const polyMeshGenPoints&);
polyMeshGenPoints(const polyMeshGenPoints&); polyMeshGenPoints(const polyMeshGenPoints&);
public: public:
friend class polyMeshGenModifier; friend class polyMeshGenModifier;
// Constructors // Constructors
@ -83,23 +83,23 @@ public:
const Time&, const Time&,
const pointField& points const pointField& points
); );
// Destructor // Destructor
~polyMeshGenPoints(); ~polyMeshGenPoints();
// Member functions // Member functions
//- access to Time //- access to Time
inline const Time& returnTime() const; inline const Time& returnTime() const;
//- access to points //- access to points
inline const pointFieldPMG& points() const; inline const pointFieldPMG& points() const;
//- non-const access to points //- non-const access to points
inline pointFieldPMG& points(); inline pointFieldPMG& points();
//- append a vertex to the end of the list //- append a vertex to the end of the list
inline void appendVertex(const point& p); inline void appendVertex(const point& p);
//- point subsets //- point subsets
label addPointSubset(const word&); label addPointSubset(const word&);
void removePointSubset(const label); void removePointSubset(const label);
@ -113,10 +113,10 @@ public:
inline void pointsInSubset(const label, ListType&) const; inline void pointsInSubset(const label, ListType&) const;
template<class ListType> template<class ListType>
inline void updatePointSubsets(const ListType&); inline void updatePointSubsets(const ListType&);
// Read mesh // Read mesh
void read(); void read();
// Write mesh // Write mesh
void write() const; void write() const;
}; };

View file

@ -40,7 +40,7 @@ inline const Time& polyMeshGenPoints::returnTime() const
{ {
return runTime_; return runTime_;
} }
inline const pointFieldPMG& polyMeshGenPoints::points() const inline const pointFieldPMG& polyMeshGenPoints::points() const
{ {
return points_; return points_;
@ -50,7 +50,7 @@ inline pointFieldPMG& polyMeshGenPoints::points()
{ {
return points_; return points_;
} }
inline void polyMeshGenPoints::appendVertex(const point& p) inline void polyMeshGenPoints::appendVertex(const point& p)
{ {
points_.append(p); points_.append(p);
@ -65,7 +65,7 @@ inline void polyMeshGenPoints::addPointToSubset
std::map<label, meshSubset>::iterator it = pointSubsets_.find(setI); std::map<label, meshSubset>::iterator it = pointSubsets_.find(setI);
if( it == pointSubsets_.end() ) if( it == pointSubsets_.end() )
return; return;
it->second.addElement(pointI); it->second.addElement(pointI);
} }
@ -78,7 +78,7 @@ inline void polyMeshGenPoints::removePointFromSubset
std::map<label, meshSubset>::iterator it = pointSubsets_.find(setI); std::map<label, meshSubset>::iterator it = pointSubsets_.find(setI);
if( it == pointSubsets_.end() ) if( it == pointSubsets_.end() )
return; return;
it->second.removeElement(pointI); it->second.removeElement(pointI);
} }
@ -89,7 +89,7 @@ inline void polyMeshGenPoints::pointInSubsets
) const ) const
{ {
pointSubsets.clear(); pointSubsets.clear();
std::map<label, meshSubset>::const_iterator it; std::map<label, meshSubset>::const_iterator it;
for for
( (
@ -106,7 +106,7 @@ inline void polyMeshGenPoints::pointInSubsets
inline void polyMeshGenPoints::pointSubsetIndices(DynList<label>& indices) const inline void polyMeshGenPoints::pointSubsetIndices(DynList<label>& indices) const
{ {
indices.clear(); indices.clear();
std::map<label, meshSubset>::const_iterator it; std::map<label, meshSubset>::const_iterator it;
for for
( (
@ -125,12 +125,12 @@ inline void polyMeshGenPoints::pointsInSubset
) const ) const
{ {
pointLabels.clear(); pointLabels.clear();
std::map<label, meshSubset>::const_iterator it = std::map<label, meshSubset>::const_iterator it =
pointSubsets_.find(setI); pointSubsets_.find(setI);
if( it == pointSubsets_.end() ) if( it == pointSubsets_.end() )
return; return;
it->second.containedElements(pointLabels); it->second.containedElements(pointLabels);
} }

View file

@ -126,38 +126,38 @@ class polyMeshGenAddressing
//- Face areas //- Face areas
mutable vectorField* faceAreasPtr_; mutable vectorField* faceAreasPtr_;
// Parallel demand driven data // Parallel demand driven data
//- global point labels //- global point labels
mutable labelLongList* globalPointLabelPtr_; mutable labelLongList* globalPointLabelPtr_;
//- global face labels //- global face labels
mutable labelLongList* globalFaceLabelPtr_; mutable labelLongList* globalFaceLabelPtr_;
//- global cell labels //- global cell labels
mutable labelLongList* globalCellLabelPtr_; mutable labelLongList* globalCellLabelPtr_;
//- global edge labels //- global edge labels
mutable labelLongList* globalEdgeLabelPtr_; mutable labelLongList* globalEdgeLabelPtr_;
// Parallel addressing // Parallel addressing
//- processors containing a vertex //- processors containing a vertex
mutable VRWGraph* pProcsPtr_; mutable VRWGraph* pProcsPtr_;
//- global to local point adressing //- global to local point adressing
mutable Map<label>* globalToLocalPointAddressingPtr_; mutable Map<label>* globalToLocalPointAddressingPtr_;
//- neighbour processors sharing a point with this processor //- neighbour processors sharing a point with this processor
mutable DynList<label>* pointNeiProcsPtr_; mutable DynList<label>* pointNeiProcsPtr_;
//- processors containing an edge //- processors containing an edge
mutable VRWGraph* eProcsPtr_; mutable VRWGraph* eProcsPtr_;
//- global to local edge addressing //- global to local edge addressing
mutable Map<label>* globalToLocalEdgeAddressingPtr_; mutable Map<label>* globalToLocalEdgeAddressingPtr_;
//- neighbour processors sharing an edge with the current processor //- neighbour processors sharing an edge with the current processor
mutable DynList<label>* edgeNeiProcsPtr_; mutable DynList<label>* edgeNeiProcsPtr_;
@ -186,7 +186,7 @@ class polyMeshGenAddressing
//- Calculate edge-face addressing //- Calculate edge-face addressing
void calcEdgeFaces() const; void calcEdgeFaces() const;
//- Calculate face-edge addressing //- Calculate face-edge addressing
void calcFaceEdges() const; void calcFaceEdges() const;
@ -211,16 +211,16 @@ class polyMeshGenAddressing
void clearOutEdges(); void clearOutEdges();
// Parallel calculations // Parallel calculations
//- calculate global point labels //- calculate global point labels
void calcGlobalPointLabels() const; void calcGlobalPointLabels() const;
//- calculate global face labels //- calculate global face labels
void calcGlobalFaceLabels() const; void calcGlobalFaceLabels() const;
//- calculate global cell labels //- calculate global cell labels
void calcGlobalCellLabels() const; void calcGlobalCellLabels() const;
//- calculate global edge labels //- calculate global edge labels
void calcGlobalEdgeLabels() const; void calcGlobalEdgeLabels() const;
@ -247,7 +247,7 @@ class polyMeshGenAddressing
//- Calculate edge vectors //- Calculate edge vectors
void calcEdgeVectors() const; void calcEdgeVectors() const;
// Disallow bitwise construct // Disallow bitwise construct
//- Default constructor //- Default constructor
polyMeshGenAddressing(); polyMeshGenAddressing();
@ -325,12 +325,12 @@ public:
const VRWGraph& cellPoints() const; const VRWGraph& cellPoints() const;
// Parallel addressing // Parallel addressing
const labelLongList& globalPointLabel() const; const labelLongList& globalPointLabel() const;
const labelLongList& globalFaceLabel() const; const labelLongList& globalFaceLabel() const;
const labelLongList& globalCellLabel() const; const labelLongList& globalCellLabel() const;
const labelLongList& globalEdgeLabel() const; const labelLongList& globalEdgeLabel() const;
const VRWGraph& pointAtProcs() const; const VRWGraph& pointAtProcs() const;
const Map<label>& globalToLocalPointAddressing() const; const Map<label>& globalToLocalPointAddressing() const;
const DynList<label>& pointNeiProcs() const; const DynList<label>& pointNeiProcs() const;
@ -355,7 +355,7 @@ public:
//- Clear topological data //- Clear topological data
void clearAddressing(); void clearAddressing();
//- Clear parallel addressing //- Clear parallel addressing
void clearParallelAddressing(); void clearParallelAddressing();
@ -364,7 +364,7 @@ public:
//- Clear everything primitive, geometry and addressing //- Clear everything primitive, geometry and addressing
void clearAll(); void clearAll();
// Update geometry data // Update geometry data
void updateGeometry(const boolList& changedFace); void updateGeometry(const boolList& changedFace);
}; };

View file

@ -50,7 +50,7 @@ namespace Foam
namespace polyMeshGenChecks namespace polyMeshGenChecks
{ {
// Check geometry // Check geometry
//- Check boundary closedness //- Check boundary closedness
bool checkClosedBoundary(const polyMeshGen&, const bool report = false); bool checkClosedBoundary(const polyMeshGen&, const bool report = false);
@ -193,7 +193,7 @@ bool checkFaceVertices
//- Check mesh topology for correctness. Returns false for no error. //- Check mesh topology for correctness. Returns false for no error.
bool checkTopology(const polyMeshGen&, const bool report = false); bool checkTopology(const polyMeshGen&, const bool report = false);
//- Check mesh geometry (& implicitly topology) for correctness. //- Check mesh geometry (& implicitly topology) for correctness.
// Returns false for no error. // Returns false for no error.
bool checkGeometry(const polyMeshGen&, const bool report = false); bool checkGeometry(const polyMeshGen&, const bool report = false);

View file

@ -44,9 +44,9 @@ void polyMeshGenModifier::addBufferCells()
{ {
if( !Pstream::parRun() ) if( !Pstream::parRun() )
return; return;
Info << "Adding buffer layers" << endl; Info << "Adding buffer layers" << endl;
const labelList& owner = mesh_.owner(); const labelList& owner = mesh_.owner();
pointFieldPMG& points = mesh_.points(); pointFieldPMG& points = mesh_.points();
faceListPMG& faces = facesAccess(); faceListPMG& faces = facesAccess();
@ -55,12 +55,12 @@ void polyMeshGenModifier::addBufferCells()
const polyMeshGenAddressing& addressing = mesh_.addressingData(); const polyMeshGenAddressing& addressing = mesh_.addressingData();
const labelLongList& globalPointLabel = addressing.globalPointLabel(); const labelLongList& globalPointLabel = addressing.globalPointLabel();
const Map<label>& globalToLocal = addressing.globalToLocalPointAddressing(); const Map<label>& globalToLocal = addressing.globalToLocalPointAddressing();
//- receive vertices //- receive vertices
forAll(procBoundaries, patchI) forAll(procBoundaries, patchI)
{ {
labelHashSet pointsToSend; labelHashSet pointsToSend;
label faceI = procBoundaries[patchI].patchStart(); label faceI = procBoundaries[patchI].patchStart();
const label end = faceI + procBoundaries[patchI].patchSize(); const label end = faceI + procBoundaries[patchI].patchSize();
for(;faceI<end;++faceI) for(;faceI<end;++faceI)
@ -69,12 +69,12 @@ void polyMeshGenModifier::addBufferCells()
forAll(c, fI) forAll(c, fI)
{ {
const face& f = faces[c[fI]]; const face& f = faces[c[fI]];
forAll(f, pI) forAll(f, pI)
pointsToSend.insert(f[pI]); pointsToSend.insert(f[pI]);
} }
} }
faceI = 0; faceI = 0;
List<labelledPoint> ptsToSend(pointsToSend.size()); List<labelledPoint> ptsToSend(pointsToSend.size());
forAllConstIter(labelHashSet, pointsToSend, it) forAllConstIter(labelHashSet, pointsToSend, it)
@ -84,16 +84,16 @@ void polyMeshGenModifier::addBufferCells()
globalPointLabel[it.key()], globalPointLabel[it.key()],
points[it.key()] points[it.key()]
); );
OPstream toOtherProc OPstream toOtherProc
( (
Pstream::blocking, Pstream::blocking,
procBoundaries[patchI].neiProcNo() procBoundaries[patchI].neiProcNo()
); );
toOtherProc << ptsToSend; toOtherProc << ptsToSend;
} }
Map<label> globalToLocalReceived; Map<label> globalToLocalReceived;
forAll(procBoundaries, patchI) forAll(procBoundaries, patchI)
{ {
@ -103,16 +103,16 @@ void polyMeshGenModifier::addBufferCells()
IPstream::blocking, IPstream::blocking,
procBoundaries[patchI].neiProcNo() procBoundaries[patchI].neiProcNo()
); );
fromOtherProc >> receivedPoints; fromOtherProc >> receivedPoints;
forAll(receivedPoints, i) forAll(receivedPoints, i)
{ {
if( globalToLocal.found(receivedPoints[i].pointLabel()) ) if( globalToLocal.found(receivedPoints[i].pointLabel()) )
continue; continue;
if( globalToLocalReceived.found(receivedPoints[i].pointLabel()) ) if( globalToLocalReceived.found(receivedPoints[i].pointLabel()) )
continue; continue;
globalToLocalReceived.insert globalToLocalReceived.insert
( (
receivedPoints[i].pointLabel(), receivedPoints[i].pointLabel(),
@ -121,62 +121,62 @@ void polyMeshGenModifier::addBufferCells()
points.append(receivedPoints[i].coordinates()); points.append(receivedPoints[i].coordinates());
} }
} }
//- send cells to other processors //- send cells to other processors
forAll(procBoundaries, patchI) forAll(procBoundaries, patchI)
{ {
labelHashSet cellsToSend; labelHashSet cellsToSend;
label faceI = procBoundaries[patchI].patchStart(); label faceI = procBoundaries[patchI].patchStart();
const label end = faceI + procBoundaries[patchI].patchSize(); const label end = faceI + procBoundaries[patchI].patchSize();
for(;faceI<end;++faceI) for(;faceI<end;++faceI)
cellsToSend.insert(owner[faceI]); cellsToSend.insert(owner[faceI]);
labelLongList flattenedCells; labelLongList flattenedCells;
forAllConstIter(labelHashSet, cellsToSend, it) forAllConstIter(labelHashSet, cellsToSend, it)
{ {
const cell& c = cells[it.key()]; const cell& c = cells[it.key()];
//- the number of faces in the cell //- the number of faces in the cell
flattenedCells.append(c.size()); flattenedCells.append(c.size());
//- add faces //- add faces
forAll(c, fI) forAll(c, fI)
{ {
const face& f = faces[c[fI]]; const face& f = faces[c[fI]];
//- the number of vertices in the face //- the number of vertices in the face
flattenedCells.append(f.size()); flattenedCells.append(f.size());
forAll(f, pI) forAll(f, pI)
flattenedCells.append(globalPointLabel[f[pI]]); flattenedCells.append(globalPointLabel[f[pI]]);
} }
} }
OPstream toOtherProc OPstream toOtherProc
( (
Pstream::blocking, Pstream::blocking,
procBoundaries[patchI].neiProcNo() procBoundaries[patchI].neiProcNo()
); );
toOtherProc << flattenedCells; toOtherProc << flattenedCells;
} }
forAll(procBoundaries, patchI) forAll(procBoundaries, patchI)
{ {
word subsetName = "processor_"; word subsetName = "processor_";
subsetName += help::scalarToText(procBoundaries[patchI].neiProcNo()); subsetName += help::scalarToText(procBoundaries[patchI].neiProcNo());
const label subsetID = mesh_.addCellSubset(subsetName); const label subsetID = mesh_.addCellSubset(subsetName);
labelList receivedCells; labelList receivedCells;
IPstream fromOtherProc IPstream fromOtherProc
( (
Pstream::blocking, Pstream::blocking,
procBoundaries[patchI].neiProcNo() procBoundaries[patchI].neiProcNo()
); );
fromOtherProc >> receivedCells; fromOtherProc >> receivedCells;
label counter(0); label counter(0);
while( counter < receivedCells.size() ) while( counter < receivedCells.size() )
{ {
@ -187,7 +187,7 @@ void polyMeshGenModifier::addBufferCells()
forAll(c[fI], pI) forAll(c[fI], pI)
{ {
const label gpI = receivedCells[counter++]; const label gpI = receivedCells[counter++];
if( globalToLocal.found(gpI) ) if( globalToLocal.found(gpI) )
{ {
c[fI][pI] = globalToLocal[gpI]; c[fI][pI] = globalToLocal[gpI];
@ -198,14 +198,14 @@ void polyMeshGenModifier::addBufferCells()
} }
} }
} }
mesh_.addCellToSubset(subsetID, cells.size()); mesh_.addCellToSubset(subsetID, cells.size());
addCell(c); addCell(c);
} }
} }
mesh_.clearOut(); mesh_.clearOut();
Info << "Finished adding buffer layers" << endl; Info << "Finished adding buffer layers" << endl;
} }

View file

@ -48,12 +48,12 @@ polyMeshGenModifierAddCellByCell::polyMeshGenModifierAddCellByCell
faceListPMG& faces = this->facesAccess(); faceListPMG& faces = this->facesAccess();
forAll(faces, faceI) forAll(faces, faceI)
newFaces_[faceI].transfer(faces[faceI]); newFaces_[faceI].transfer(faces[faceI]);
cellListPMG& cells = this->cellsAccess(); cellListPMG& cells = this->cellsAccess();
forAll(cells, cellI) forAll(cells, cellI)
newCells_[cellI].transfer(cells[cellI]); newCells_[cellI].transfer(cells[cellI]);
}; };
// Destructor // Destructor
polyMeshGenModifierAddCellByCell::~polyMeshGenModifierAddCellByCell() polyMeshGenModifierAddCellByCell::~polyMeshGenModifierAddCellByCell()
{ {
@ -61,46 +61,46 @@ polyMeshGenModifierAddCellByCell::~polyMeshGenModifierAddCellByCell()
faces.setSize(nFaces_); faces.setSize(nFaces_);
forAll(faces, faceI) forAll(faces, faceI)
faces[faceI].transfer(newFaces_[faceI]); faces[faceI].transfer(newFaces_[faceI]);
cellListPMG& cells = this->cellsAccess(); cellListPMG& cells = this->cellsAccess();
cells.setSize(newCells_.size()); cells.setSize(newCells_.size());
forAll(cells, cellI) forAll(cells, cellI)
cells[cellI].transfer(newCells_[cellI]); cells[cellI].transfer(newCells_[cellI]);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void polyMeshGenModifierAddCellByCell::addCell(const faceList& cellFaces) void polyMeshGenModifierAddCellByCell::addCell(const faceList& cellFaces)
{ {
cell c(cellFaces.size()); cell c(cellFaces.size());
VRWGraph& pointFaces = this->pointFaces(); VRWGraph& pointFaces = this->pointFaces();
forAll(cellFaces, faceI) forAll(cellFaces, faceI)
{ {
const face& f = cellFaces[faceI]; const face& f = cellFaces[faceI];
const label pointI = f[0]; const label pointI = f[0];
label fLabel(-1); label fLabel(-1);
forAllRow(pointFaces, pointI, pfI) forAllRow(pointFaces, pointI, pfI)
{ {
const label faceI = pointFaces(pointI, pfI); const label faceI = pointFaces(pointI, pfI);
if( newFaces_[faceI] == f ) if( newFaces_[faceI] == f )
{ {
fLabel = faceI; fLabel = faceI;
break; break;
} }
} }
if( fLabel == -1 ) if( fLabel == -1 )
{ {
newFaces_.append(f); newFaces_.append(f);
c[faceI] = nFaces_; c[faceI] = nFaces_;
forAll(f, pI) forAll(f, pI)
pointFaces.append(f[pI], nFaces_); pointFaces.append(f[pI], nFaces_);
++nFaces_; ++nFaces_;
} }
else else
@ -108,7 +108,7 @@ void polyMeshGenModifierAddCellByCell::addCell(const faceList& cellFaces)
c[faceI] = fLabel; c[faceI] = fLabel;
} }
} }
newCells_.append(c); newCells_.append(c);
++nCells_; ++nCells_;
} }

View file

@ -51,7 +51,7 @@ class polyMeshGenModifierAddCellByCell
//- number of faces //- number of faces
label nFaces_; label nFaces_;
LongList<face> newFaces_; LongList<face> newFaces_;
//- number of cells //- number of cells
label nCells_; label nCells_;
LongList<cell> newCells_; LongList<cell> newCells_;
@ -61,10 +61,10 @@ public:
// Constructors // Constructors
//- Construct from the reference to the mesh //- Construct from the reference to the mesh
polyMeshGenModifierAddCellByCell(polyMeshGen& mesh); polyMeshGenModifierAddCellByCell(polyMeshGen& mesh);
// Destructor // Destructor
~polyMeshGenModifierAddCellByCell(); ~polyMeshGenModifierAddCellByCell();
// Member functions // Member functions
//- add a single cell (vertices must be added); //- add a single cell (vertices must be added);
void addCell(const faceList& cell); void addCell(const faceList& cell);

View file

@ -42,12 +42,12 @@ namespace Foam
void polyMeshGenModifier::zipUpCells() void polyMeshGenModifier::zipUpCells()
{ {
this->clearOut(); this->clearOut();
Info<< "Zipping up topologically open cells" << endl; Info<< "Zipping up topologically open cells" << endl;
const pointFieldPMG& points = mesh_.points(); const pointFieldPMG& points = mesh_.points();
const cellListPMG& cells = mesh_.cells(); const cellListPMG& cells = mesh_.cells();
faceListPMG& faces = mesh_.faces_; faceListPMG& faces = mesh_.faces_;
// Algorithm: // Algorithm:
@ -67,7 +67,7 @@ void polyMeshGenModifier::zipUpCells()
// pass. It is therefore essential to discard the addressing // pass. It is therefore essential to discard the addressing
// after every pass. The algorithm is completed when the mesh // after every pass. The algorithm is completed when the mesh
// stops changing. // stops changing.
// //
label nChangedFacesInMesh; label nChangedFacesInMesh;
label nCycles(0); label nCycles(0);
@ -77,7 +77,7 @@ void polyMeshGenModifier::zipUpCells()
do do
{ {
nChangedFacesInMesh = 0; nChangedFacesInMesh = 0;
//- calculate pointFaces addressing //- calculate pointFaces addressing
# ifdef DEBUG_ZIPUP # ifdef DEBUG_ZIPUP
Info << "Starting pointFaces addressing " << endl; Info << "Starting pointFaces addressing " << endl;
@ -90,20 +90,20 @@ void polyMeshGenModifier::zipUpCells()
forAll(f, pI) forAll(f, pI)
++nUsage[f[pI]]; ++nUsage[f[pI]];
} }
VRWGraph pFaces(points.size()); VRWGraph pFaces(points.size());
forAll(nUsage, pI) forAll(nUsage, pI)
pFaces.setRowSize(pI, nUsage[pI]); pFaces.setRowSize(pI, nUsage[pI]);
nUsage = 0; nUsage = 0;
forAll(faces, fI) forAll(faces, fI)
{ {
const face& f = faces[fI]; const face& f = faces[fI];
forAll(f, pI) forAll(f, pI)
pFaces(f[pI], nUsage[f[pI]]++) = fI; pFaces(f[pI], nUsage[f[pI]]++) = fI;
} }
nUsage.clear(); nUsage.clear();
# ifdef DEBUG_ZIPUP # ifdef DEBUG_ZIPUP
@ -271,7 +271,7 @@ void polyMeshGenModifier::zipUpCells()
// Go through the points and start from the point used twice // Go through the points and start from the point used twice
// check all the edges to find the edges starting from this point // check all the edges to find the edges starting from this point
// add the // add the
labelListList edgesToInsert(singleEdges.size()); labelListList edgesToInsert(singleEdges.size());
label nEdgesToInsert = 0; label nEdgesToInsert = 0;
@ -472,7 +472,7 @@ void polyMeshGenModifier::zipUpCells()
// Warning: the ordering must be parametric, because in // Warning: the ordering must be parametric, because in
// the case of multiple point insertion onto the same edge // the case of multiple point insertion onto the same edge
// it is possible to get non-cyclic loops // it is possible to get non-cyclic loops
// //
const labelList& unorderedEdge = edgesToInsert[edgeToInsertI]; const labelList& unorderedEdge = edgesToInsert[edgeToInsertI];
@ -552,17 +552,17 @@ void polyMeshGenModifier::zipUpCells()
// point-face addressing in two goes. // point-face addressing in two goes.
const label start = testEdge.start(); const label start = testEdge.start();
const label end = testEdge.end(); const label end = testEdge.end();
labelList facesSharingEdge labelList facesSharingEdge
( (
pFaces.sizeOfRow(start) + pFaces.sizeOfRow(start) +
pFaces.sizeOfRow(end) pFaces.sizeOfRow(end)
); );
label nfse = 0; label nfse = 0;
forAllRow(pFaces, start, pfI) forAllRow(pFaces, start, pfI)
facesSharingEdge[nfse++] = pFaces(start, pfI); facesSharingEdge[nfse++] = pFaces(start, pfI);
forAllRow(pFaces, end, pfI) forAllRow(pFaces, end, pfI)
facesSharingEdge[nfse++] = pFaces(end, pfI); facesSharingEdge[nfse++] = pFaces(end, pfI);
@ -708,7 +708,7 @@ void polyMeshGenModifier::zipUpCells()
nNewFacePoints++; nNewFacePoints++;
} }
} }
forAll(newFace, pI) forAll(newFace, pI)
pFaces.appendIfNotIn pFaces.appendIfNotIn
( (
@ -721,7 +721,7 @@ void polyMeshGenModifier::zipUpCells()
<< faces[currentFaceIndex] << nl << faces[currentFaceIndex] << nl
<< "newFace: " << newFace << endl; << "newFace: " << newFace << endl;
# endif # endif
// Check for duplicate points in the new face // Check for duplicate points in the new face
forAll (newFace, checkI) forAll (newFace, checkI)
{ {

View file

@ -54,7 +54,7 @@ class Ostream;
class partTet class partTet
{ {
protected: protected:
// Protected data // Protected data
label data_[4]; label data_[4];
@ -89,9 +89,9 @@ public:
inline label c() const; inline label c() const;
inline label d() const; inline label d() const;
inline label size() const; inline label size() const;
// Searches // Searches
//- find position of the node in the partTet //- find position of the node in the partTet
inline label whichPosition(const label) const; inline label whichPosition(const label) const;
@ -115,25 +115,25 @@ public:
//- Return volume //- Return volume
template<class PointField> template<class PointField>
inline scalar mag(const PointField&) const; inline scalar mag(const PointField&) const;
//- Return circum-centre //- Return circum-centre
template<class PointField> template<class PointField>
inline point crcmCentre(const PointField&) const; inline point crcmCentre(const PointField&) const;
template<class PointField> template<class PointField>
inline scalar crcmRadius(const PointField&) const; inline scalar crcmRadius(const PointField&) const;
//- Return centroid of the tetrahedron //- Return centroid of the tetrahedron
template<class PointField> template<class PointField>
inline point centroid(const PointField&) const; inline point centroid(const PointField&) const;
//- Return edges //- Return edges
edgeList edges() const; edgeList edges() const;
// Member operators // Member operators
inline label operator[](const label) const; inline label operator[](const label) const;
inline void operator=(const partTet&); inline void operator=(const partTet&);
// IOstream operators // IOstream operators

View file

@ -39,7 +39,7 @@ namespace Foam
inline partTet::partTet() inline partTet::partTet()
{ {
} }
inline partTet::partTet inline partTet::partTet
( (
const label a, const label a,
@ -90,7 +90,7 @@ inline label partTet::whichPosition(const label pointI) const
for(label i=0;i<4;++i) for(label i=0;i<4;++i)
if( data_[i] == pointI ) if( data_[i] == pointI )
return i; return i;
return -1; return -1;
} }
@ -103,7 +103,7 @@ inline vector partTet::Sa(const PointField& points) const
points[data_[2]], points[data_[2]],
points[data_[3]] points[data_[3]]
); );
return tria.normal(); return tria.normal();
//return triangle<point, point>(b_, c_, d_).normal(); //return triangle<point, point>(b_, c_, d_).normal();
} }
@ -117,7 +117,7 @@ inline vector partTet::Sb(const PointField& points) const
points[data_[3]], points[data_[3]],
points[data_[2]] points[data_[2]]
); );
return tria.normal(); return tria.normal();
//return triangle<point, point>(a_, d_, c_).normal(); //return triangle<point, point>(a_, d_, c_).normal();
} }
@ -131,7 +131,7 @@ inline vector partTet::Sc(const PointField& points) const
points[data_[1]], points[data_[1]],
points[data_[3]] points[data_[3]]
); );
return tria.normal(); return tria.normal();
//return triangle<point, point>(a_, b_, d_).normal(); //return triangle<point, point>(a_, b_, d_).normal();
} }
@ -145,7 +145,7 @@ inline vector partTet::Sd(const PointField& points) const
points[data_[2]], points[data_[2]],
points[data_[1]] points[data_[1]]
); );
return tria.normal(); return tria.normal();
//return triangle<point, point>(a_, c_, b_).normal(); //return triangle<point, point>(a_, c_, b_).normal();
} }
@ -160,7 +160,7 @@ inline scalar partTet::mag(const PointField& points) const
points[data_[2]], points[data_[2]],
points[data_[3]] points[data_[3]]
); );
return tet.mag(); return tet.mag();
//return (1.0/6.0)*(((b_ - a_) ^ (c_ - a_)) & (d_ - a_)); //return (1.0/6.0)*(((b_ - a_) ^ (c_ - a_)) & (d_ - a_));
} }
@ -175,7 +175,7 @@ inline point partTet::crcmCentre(const PointField& points) const
points[data_[2]], points[data_[2]],
points[data_[3]] points[data_[3]]
); );
return tet.circumCentre(); return tet.circumCentre();
} }
@ -189,7 +189,7 @@ inline scalar partTet::crcmRadius(const PointField& points) const
points[data_[2]], points[data_[2]],
points[data_[3]] points[data_[3]]
); );
return tet.circumRadius(); return tet.circumRadius();
} }
@ -199,7 +199,7 @@ inline point partTet::centroid(const PointField& points) const
point p = points[data_[0]]; point p = points[data_[0]];
for(label i=1;i<4;++i) for(label i=1;i<4;++i)
p += points[data_[i]]; p += points[data_[i]];
p /= 4; p /= 4;
return p; return p;
} }

View file

@ -62,131 +62,131 @@ class meshOctreeAddressing
// Private data // Private data
//- reference to the octree //- reference to the octree
const meshOctree& octree_; const meshOctree& octree_;
//- reference to the dictionary //- reference to the dictionary
const dictionary& meshDict_; const dictionary& meshDict_;
//- use DATA boxes //- use DATA boxes
bool useDATABoxes_; bool useDATABoxes_;
//- number of created octree nodes //- number of created octree nodes
mutable label nNodes_; mutable label nNodes_;
//- coordinates of octree nodes //- coordinates of octree nodes
mutable pointField* octreePointsPtr_; mutable pointField* octreePointsPtr_;
//- node labels //- node labels
mutable VRWGraph* nodeLabelsPtr_; mutable VRWGraph* nodeLabelsPtr_;
//- node leaves //- node leaves
mutable FRWGraph<label, 8>* nodeLeavesPtr_; mutable FRWGraph<label, 8>* nodeLeavesPtr_;
//- identify which boxes should be used as mesh cells //- identify which boxes should be used as mesh cells
mutable List<direction>* boxTypePtr_; mutable List<direction>* boxTypePtr_;
//- identify created nodes as OUTERNODE or INNERNODE //- identify created nodes as OUTERNODE or INNERNODE
mutable List<direction>* nodeTypePtr_; mutable List<direction>* nodeTypePtr_;
// Additional addressing useful for some algorithms // Additional addressing useful for some algorithms
//- faces of the octree //- faces of the octree
mutable VRWGraph* octreeFacesPtr_; mutable VRWGraph* octreeFacesPtr_;
mutable labelLongList* octreeFacesOwnersPtr_; mutable labelLongList* octreeFacesOwnersPtr_;
mutable labelLongList* octreeFacesNeighboursPtr_; mutable labelLongList* octreeFacesNeighboursPtr_;
//- octree box-faces addressing //- octree box-faces addressing
mutable VRWGraph* leafFacesPtr_; mutable VRWGraph* leafFacesPtr_;
//- node-faces addressing //- node-faces addressing
mutable VRWGraph* nodeFacesPtr_; mutable VRWGraph* nodeFacesPtr_;
//- leaf-leaves addressing //- leaf-leaves addressing
mutable VRWGraph* leafLeavesPtr_; mutable VRWGraph* leafLeavesPtr_;
//- edges of the octree //- edges of the octree
mutable LongList<edge>* octreeEdgesPtr_; mutable LongList<edge>* octreeEdgesPtr_;
//- edges-leaves addressing //- edges-leaves addressing
mutable VRWGraph* edgeLeavesPtr_; mutable VRWGraph* edgeLeavesPtr_;
//- leaf-edges addressing //- leaf-edges addressing
mutable VRWGraph* leafEdgesPtr_; mutable VRWGraph* leafEdgesPtr_;
//- node-edges addressing //- node-edges addressing
mutable VRWGraph* nodeEdgesPtr_; mutable VRWGraph* nodeEdgesPtr_;
//- face-edges addressing //- face-edges addressing
mutable VRWGraph* faceEdgesPtr_; mutable VRWGraph* faceEdgesPtr_;
//- edge-faces addressing //- edge-faces addressing
mutable VRWGraph* edgeFacesPtr_; mutable VRWGraph* edgeFacesPtr_;
//- global octree point label //- global octree point label
mutable labelLongList* globalPointLabelPtr_; mutable labelLongList* globalPointLabelPtr_;
//- global point to local label addressing //- global point to local label addressing
mutable Map<label>* globalPointToLocalPtr_; mutable Map<label>* globalPointToLocalPtr_;
//- point-processors addressing //- point-processors addressing
mutable VRWGraph* pointProcsPtr_; mutable VRWGraph* pointProcsPtr_;
//- global octree face label //- global octree face label
mutable labelLongList* globalFaceLabelPtr_; mutable labelLongList* globalFaceLabelPtr_;
//- global face label to local label addressing //- global face label to local label addressing
mutable Map<label>* globalFaceToLocalPtr_; mutable Map<label>* globalFaceToLocalPtr_;
//- face-processors addressing //- face-processors addressing
mutable VRWGraph* faceProcsPtr_; mutable VRWGraph* faceProcsPtr_;
//- global leaf label //- global leaf label
mutable labelLongList* globalLeafLabelPtr_; mutable labelLongList* globalLeafLabelPtr_;
//- global leaf label to local label addressing for octree leaves //- global leaf label to local label addressing for octree leaves
mutable Map<label>* globalLeafToLocalPtr_; mutable Map<label>* globalLeafToLocalPtr_;
//- leaf at procs //- leaf at procs
mutable VRWGraph* leafAtProcsPtr_; mutable VRWGraph* leafAtProcsPtr_;
// Private member functions // Private member functions
//- calculate octreePointsPtr_ //- calculate octreePointsPtr_
void createOctreePoints() const; void createOctreePoints() const;
//- calculate nodeLabelsPtr_ //- calculate nodeLabelsPtr_
void createNodeLabels() const; void createNodeLabels() const;
//- calculate nodeLeavesPtr_ //- calculate nodeLeavesPtr_
void createNodeLeaves() const; void createNodeLeaves() const;
//- assemble boxTypePtr_ list //- assemble boxTypePtr_ list
void findUsedBoxes() const; void findUsedBoxes() const;
//- calculate nodeTypePtr_ //- calculate nodeTypePtr_
void calculateNodeType() const; void calculateNodeType() const;
//- calculate faces //- calculate faces
void createOctreeFaces() const; void createOctreeFaces() const;
//- calculate leaf-faces addressing //- calculate leaf-faces addressing
void calculateLeafFaces() const; void calculateLeafFaces() const;
//- calculate node-faces addressing //- calculate node-faces addressing
void calculateNodeFaces() const; void calculateNodeFaces() const;
//- calculate leaf-leaves addressing //- calculate leaf-leaves addressing
void calculateLeafLeaves() const; void calculateLeafLeaves() const;
//- calculate edges //- calculate edges
void createOctreeEdges() const; void createOctreeEdges() const;
//- calculate leaf-edges //- calculate leaf-edges
void calculateLeafEdges() const; void calculateLeafEdges() const;
//- calculate edge-leaves addressing //- calculate edge-leaves addressing
void calculateEdgeLeaves() const; void calculateEdgeLeaves() const;
//- calculate edge-faces //- calculate edge-faces
void calculateEdgeFaces() const; void calculateEdgeFaces() const;
//- Clear allocated data //- Clear allocated data
void clearOut(); void clearOut();
void clearBoxTypes(); void clearBoxTypes();
@ -194,12 +194,12 @@ class meshOctreeAddressing
void clearOctreeFaces(); void clearOctreeFaces();
void clearAddressing(); void clearAddressing();
void clearParallelAddressing(); void clearParallelAddressing();
//- check if distinct parts are glued together //- check if distinct parts are glued together
void checkGluedRegions(); void checkGluedRegions();
// Private member functions for parallel runs // Private member functions for parallel runs
void calcGlobalPointLabels() const; void calcGlobalPointLabels() const;
void calcGlobalFaceLabels() const; void calcGlobalFaceLabels() const;
void calcGlobalLeafLabels() const; void calcGlobalLeafLabels() const;
@ -239,9 +239,9 @@ public:
OUTERNODE = 16, OUTERNODE = 16,
BOUNDARYNODE = 32 BOUNDARYNODE = 32
}; };
// Member Functions // Member Functions
//- check if there exist any non-signly connected edges and vertices //- check if there exist any non-signly connected edges and vertices
//- in the octree mesh. This is primarily needed //- in the octree mesh. This is primarily needed
//- for the cartesian template //- for the cartesian template
@ -249,7 +249,7 @@ public:
//- return number of octree nodes //- return number of octree nodes
inline label numberOfNodes() const; inline label numberOfNodes() const;
//- return coordinates of octree vertices //- return coordinates of octree vertices
inline const pointField& octreePoints() const; inline const pointField& octreePoints() const;
@ -258,46 +258,46 @@ public:
//- return nodeLeaves //- return nodeLeaves
inline const FRWGraph<label, 8>& nodeLeaves() const; inline const FRWGraph<label, 8>& nodeLeaves() const;
//- return which octree boxes are used for mesh creation //- return which octree boxes are used for mesh creation
inline const List<direction>& boxType() const; inline const List<direction>& boxType() const;
//- return type of node (INNERNODE,or OUTERNODE) //- return type of node (INNERNODE,or OUTERNODE)
inline const List<direction>& nodeType() const; inline const List<direction>& nodeType() const;
//- set box type //- set box type
inline void setBoxType(const label boxI, const direction type); inline void setBoxType(const label boxI, const direction type);
//- return octree faces, created for MESHCELL boxes //- return octree faces, created for MESHCELL boxes
inline const VRWGraph& octreeFaces() const; inline const VRWGraph& octreeFaces() const;
//- return owners of octree faces //- return owners of octree faces
inline const labelLongList& octreeFaceOwner() const; inline const labelLongList& octreeFaceOwner() const;
//- return neighbours of octree faces //- return neighbours of octree faces
inline const labelLongList& octreeFaceNeighbour() const; inline const labelLongList& octreeFaceNeighbour() const;
//- return octree box-faces addressing //- return octree box-faces addressing
inline const VRWGraph& leafFaces() const; inline const VRWGraph& leafFaces() const;
//- checks if the face is intersected by the surface //- checks if the face is intersected by the surface
bool isIntersectedFace(const label fI) const; bool isIntersectedFace(const label fI) const;
//- return leaf-leaves addressing //- return leaf-leaves addressing
inline const VRWGraph& leafLeaves() const; inline const VRWGraph& leafLeaves() const;
//- return node-faces addressing //- return node-faces addressing
inline const VRWGraph& nodeFaces() const; inline const VRWGraph& nodeFaces() const;
//- return octree edges, created for MESHCELL boxes //- return octree edges, created for MESHCELL boxes
inline const LongList<edge>& octreeEdges() const; inline const LongList<edge>& octreeEdges() const;
//- return edge-leaves addressing //- return edge-leaves addressing
inline const VRWGraph& edgeLeaves() const; inline const VRWGraph& edgeLeaves() const;
//- return leaf-edges addressing //- return leaf-edges addressing
inline const VRWGraph& leafEdges() const; inline const VRWGraph& leafEdges() const;
//- checks if the edge is intersected by the surface //- checks if the edge is intersected by the surface
bool isIntersectedEdge(const label eI) const; bool isIntersectedEdge(const label eI) const;
void edgeIntersections void edgeIntersections
@ -305,19 +305,19 @@ public:
const label eI, const label eI,
DynList<point>& intersections DynList<point>& intersections
) const; ) const;
//- return node-edges addressing //- return node-edges addressing
inline const VRWGraph& nodeEdges() const; inline const VRWGraph& nodeEdges() const;
//- return face-edges addressing //- return face-edges addressing
inline const VRWGraph& faceEdges() const; inline const VRWGraph& faceEdges() const;
//- return edge-faces addressing //- return edge-faces addressing
inline const VRWGraph& edgeFaces() const; inline const VRWGraph& edgeFaces() const;
//- return const reference to meshOctree //- return const reference to meshOctree
inline const meshOctree& octree() const; inline const meshOctree& octree() const;
//- find cubes around an edge (cubes must be at the same level) //- find cubes around an edge (cubes must be at the same level)
void cubesAroundEdge void cubesAroundEdge
( (
@ -325,36 +325,36 @@ public:
const direction eI, const direction eI,
FixedList<label, 4>& edgeCubes FixedList<label, 4>& edgeCubes
) const; ) const;
//- find edge centre if it exists //- find edge centre if it exists
label findEdgeCentre(const label leafI, const direction eI) const; label findEdgeCentre(const label leafI, const direction eI) const;
// Access to data needed for parallel execution // Access to data needed for parallel execution
//- return global point labels //- return global point labels
inline const labelLongList& globalPointLabel() const; inline const labelLongList& globalPointLabel() const;
//- global point label to local label. Only for processors points //- global point label to local label. Only for processors points
inline const Map<label>& globalToLocalPointAddressing() const; inline const Map<label>& globalToLocalPointAddressing() const;
//- processors which contain an octree point //- processors which contain an octree point
inline const VRWGraph& pointAtProcs() const; inline const VRWGraph& pointAtProcs() const;
//- return global labels of octree faces //- return global labels of octree faces
inline const labelLongList& globalFaceLabel() const; inline const labelLongList& globalFaceLabel() const;
//- return global face label to face label. Only for processor faces //- return global face label to face label. Only for processor faces
inline const Map<label>& globalToLocalFaceAddressing() const; inline const Map<label>& globalToLocalFaceAddressing() const;
//- return processors which contain each octree face //- return processors which contain each octree face
inline const VRWGraph& faceAtProcs() const; inline const VRWGraph& faceAtProcs() const;
//- return global labels of octree leaves //- return global labels of octree leaves
inline const labelLongList& globalLeafLabel() const; inline const labelLongList& globalLeafLabel() const;
//- return processors which contain each octree leaf //- return processors which contain each octree leaf
inline const VRWGraph& leafAtProcs() const; inline const VRWGraph& leafAtProcs() const;
//- return global leaf label to local label addressing //- return global leaf label to local label addressing
inline const Map<label>& globalToLocalLeafAddressing() const; inline const Map<label>& globalToLocalLeafAddressing() const;
}; };

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