Bugfix: update cfMesh to v1.1 which fixes self-comparison always evaluates to false [-Wtautological-compare]
This commit is contained in:
parent
b9ba5ebf2e
commit
5f08a2f90a
305 changed files with 164476 additions and 162251 deletions
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Reads the AVL's surface mesh
|
Reads the AVL's surface mesh
|
||||||
|
@ -27,8 +27,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "triSurf.H"
|
#include "triSurf.H"
|
||||||
#include "triSurfModifier.H"
|
#include "triSurfModifier.H"
|
||||||
#include "triFaceList.H"
|
#include "triFaceList.H"
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Creates surface patches from surface subsets
|
Creates surface patches from surface subsets
|
||||||
|
@ -27,8 +27,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "triSurf.H"
|
#include "triSurf.H"
|
||||||
#include "triSurfaceCopyParts.H"
|
#include "triSurfaceCopyParts.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
cfMesh utility to convert a surface file to VTK multiblock dataset
|
cfMesh utility to convert a surface file to VTK multiblock dataset
|
||||||
|
@ -45,29 +45,29 @@ using namespace Foam;
|
||||||
void writePointsToVTK
|
void writePointsToVTK
|
||||||
(
|
(
|
||||||
const fileName& fn,
|
const fileName& fn,
|
||||||
const string& title,
|
const string& /*title*/,
|
||||||
const UList<point>& points
|
const UList<point>& points
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,17 +78,17 @@ void writePointsToVTK
|
||||||
const fileName& fn,
|
const fileName& fn,
|
||||||
const string& title,
|
const string& title,
|
||||||
const UList<point>& points,
|
const UList<point>& points,
|
||||||
unallocLabelList& addr
|
UList<label>& addr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// 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,
|
||||||
|
@ -102,29 +102,29 @@ void writePointsToVTK
|
||||||
void writeEdgesToVTK
|
void writeEdgesToVTK
|
||||||
(
|
(
|
||||||
const fileName& fn,
|
const fileName& fn,
|
||||||
const string& title,
|
const string& /*title*/,
|
||||||
const UList<point>& points,
|
const UList<point>& points,
|
||||||
const LongList<edge>& edges
|
const LongList<edge>& edges
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
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;
|
||||||
|
|
||||||
|
@ -158,35 +158,35 @@ void writeEdgesToVTK
|
||||||
const string& title,
|
const string& title,
|
||||||
const UList<point>& points,
|
const UList<point>& points,
|
||||||
const LongList<edge>& edges,
|
const LongList<edge>& edges,
|
||||||
const unallocLabelList& addr
|
const UList<label>& addr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Remove unused points and create subaddressed edges
|
// Remove unused points and create subaddressed edges
|
||||||
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,
|
||||||
|
@ -201,36 +201,36 @@ void writeEdgesToVTK
|
||||||
void writeFacetsToVTK
|
void writeFacetsToVTK
|
||||||
(
|
(
|
||||||
const fileName& fn,
|
const fileName& fn,
|
||||||
const string& title,
|
const string& /*title*/,
|
||||||
const UList<point>& points,
|
const UList<point>& points,
|
||||||
const LongList<labelledTri>& facets
|
const LongList<labelledTri>& facets
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,35 +274,35 @@ void writeFacetsToVTK
|
||||||
const string& title,
|
const string& title,
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const LongList<labelledTri>& facets,
|
const LongList<labelledTri>& facets,
|
||||||
const unallocLabelList& addr
|
const UList<label>& 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | For copyright notice see file Copyright
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of foam-extend.
|
||||||
|
@ -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
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Application
|
Application
|
||||||
Generates cartesian mesh
|
Generates cartesian mesh
|
||||||
|
@ -30,8 +30,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "cartesian2DMeshGenerator.H"
|
#include "cartesian2DMeshGenerator.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Application
|
Application
|
||||||
Generates cartesian mesh
|
Generates cartesian mesh
|
||||||
|
@ -30,8 +30,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "cartesianMeshGenerator.H"
|
#include "cartesianMeshGenerator.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Finds feature edges and corners of a triangulated surface
|
Finds feature edges and corners of a triangulated surface
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Reads the surface mesh, remove the selected facets
|
Reads the surface mesh, remove the selected facets
|
||||||
|
@ -28,8 +28,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "triSurf.H"
|
#include "triSurf.H"
|
||||||
#include "triSurfaceExtrude2DEdges.H"
|
#include "triSurfaceExtrude2DEdges.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
|
|
|
@ -28,8 +28,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "polyMeshGenModifier.H"
|
#include "polyMeshGenModifier.H"
|
||||||
#include "meshOptimizer.H"
|
#include "meshOptimizer.H"
|
||||||
#include "boundaryLayers.H"
|
#include "boundaryLayers.H"
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Finds feature edges and corners of a triangulated surface
|
Finds feature edges and corners of a triangulated surface
|
||||||
|
|
|
@ -28,8 +28,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "polyMeshGenModifier.H"
|
#include "polyMeshGenModifier.H"
|
||||||
#include "meshOptimizer.H"
|
#include "meshOptimizer.H"
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Ensures that all mesh points belonging to a symmetryPlane are
|
Ensures that all mesh points belonging to a symmetryPlane are
|
||||||
|
@ -28,8 +28,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "polyMeshGenModifier.H"
|
#include "polyMeshGenModifier.H"
|
||||||
#include "symmetryPlaneOptimisation.H"
|
#include "symmetryPlaneOptimisation.H"
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
cfMesh utility to merge the supplied list of patches onto a single
|
cfMesh utility to merge the supplied list of patches onto a single
|
||||||
|
@ -31,8 +31,6 @@ Author
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
#include "triSurf.H"
|
#include "triSurf.H"
|
||||||
#include "triSurfModifier.H"
|
#include "triSurfModifier.H"
|
||||||
|
@ -52,10 +50,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)
|
||||||
|
@ -66,7 +64,7 @@ void getPatchIds
|
||||||
nFound++;
|
nFound++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nFound != patchNames.size())
|
if (nFound != patchNames.size())
|
||||||
{
|
{
|
||||||
WarningIn("getPatchIds")
|
WarningIn("getPatchIds")
|
||||||
|
@ -84,17 +82,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
|
||||||
|
@ -116,17 +114,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
|
||||||
|
@ -148,17 +146,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
|
||||||
|
@ -182,20 +180,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)
|
||||||
{
|
{
|
||||||
|
@ -206,35 +204,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 UList<label>& 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)
|
||||||
{
|
{
|
||||||
|
@ -244,13 +242,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())
|
||||||
{
|
{
|
||||||
|
@ -265,7 +263,7 @@ autoPtr<triSurf> mergeSurfacePatches
|
||||||
{
|
{
|
||||||
patchCount++;
|
patchCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new surface
|
// Create new surface
|
||||||
autoPtr<triSurf> newSurf
|
autoPtr<triSurf> newSurf
|
||||||
(
|
(
|
||||||
|
@ -277,17 +275,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;
|
||||||
}
|
}
|
||||||
|
@ -310,18 +308,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;
|
||||||
|
@ -329,10 +327,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"))
|
||||||
|
@ -340,10 +338,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,
|
||||||
|
@ -354,32 +352,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
|
||||||
(
|
(
|
||||||
|
@ -388,16 +386,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Writes the mesh in fpma format readable by AVL's CfdWM
|
Writes the mesh in fpma format readable by AVL's CfdWM
|
||||||
|
@ -27,8 +27,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "polyMeshGenModifier.H"
|
#include "polyMeshGenModifier.H"
|
||||||
#include "writeMeshFPMA.H"
|
#include "writeMeshFPMA.H"
|
||||||
|
|
||||||
|
@ -43,15 +41,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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "voronoiMeshGenerator.H"
|
#include "voronoiMeshGenerator.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Converts specified patches into subsets
|
Converts specified patches into subsets
|
||||||
|
@ -27,8 +27,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "triSurf.H"
|
#include "triSurf.H"
|
||||||
#include "triFaceList.H"
|
#include "triFaceList.H"
|
||||||
#include "labelLongList.H"
|
#include "labelLongList.H"
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Application
|
Application
|
||||||
Prepares the case for a parallel mesh generation run
|
Prepares the case for a parallel mesh generation run
|
||||||
|
@ -30,8 +30,7 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
#include "polyMeshGen.H"
|
||||||
#include "foamTime.H"
|
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
@ -83,16 +82,13 @@ int main(int argc, char *argv[])
|
||||||
file += ss.str();
|
file += ss.str();
|
||||||
Info << "Creating " << file << endl;
|
Info << "Creating " << file << endl;
|
||||||
|
|
||||||
// create a directory for processor data
|
//- create a directory for processor data
|
||||||
mkDir(runTime.path()/file);
|
mkDir(runTime.path()/file);
|
||||||
|
|
||||||
// generate constant directories
|
//- copy the contents of the const directory into processor*
|
||||||
mkDir(runTime.path()/"constant");
|
|
||||||
|
|
||||||
// copy the contents of the const directory into processor*
|
|
||||||
cp(runTime.path()/"constant", runTime.path()/file);
|
cp(runTime.path()/"constant", runTime.path()/file);
|
||||||
|
|
||||||
// generate 0 directories
|
//- generate 0 directories for
|
||||||
mkDir(runTime.path()/file/"0");
|
mkDir(runTime.path()/file/"0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Reads the surface mesh, remove the selected facets
|
Reads the surface mesh, remove the selected facets
|
||||||
|
@ -28,8 +28,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "triSurf.H"
|
#include "triSurf.H"
|
||||||
#include "triSurfaceRemoveFacets.H"
|
#include "triSurfaceRemoveFacets.H"
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Creates surface patches from surface subsets
|
Creates surface patches from surface subsets
|
||||||
|
@ -27,8 +27,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "triSurf.H"
|
#include "triSurf.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Finds feature edges and corners of a triangulated surface
|
Finds feature edges and corners of a triangulated surface
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Finds feature edges and corners of a triangulated surface
|
Finds feature edges and corners of a triangulated surface
|
||||||
|
@ -29,14 +29,14 @@ Description
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "fileName.H"
|
#include "fileName.H"
|
||||||
|
#include "triSurf.H"
|
||||||
#include "triSurfModifier.H"
|
#include "triSurfModifier.H"
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "triSurfaceDetectFeatureEdges.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
// Main program:
|
// Main program:
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
@ -121,12 +121,12 @@ int main(int argc, char *argv[])
|
||||||
//- generate bounding bound triangles
|
//- generate bounding bound triangles
|
||||||
const label nTriangles = origSurface.size();
|
const label nTriangles = origSurface.size();
|
||||||
LongList<labelledTri>& newTriangles = sMod.facetsAccess();
|
LongList<labelledTri>& newTriangles = sMod.facetsAccess();
|
||||||
newTriangles.setSize(nTriangles + 12);
|
newTriangles.setSize(nTriangles+12);
|
||||||
|
|
||||||
//- create patches
|
//- create patches
|
||||||
geometricSurfacePatchList& newPatches = sMod.patchesAccess();
|
geometricSurfacePatchList& newPatches = sMod.patchesAccess();
|
||||||
const label nPatches = origSurface.patches().size();
|
const label nPatches = origSurface.patches().size();
|
||||||
newPatches.setSize(nPatches + 6);
|
newPatches.setSize(nPatches+6);
|
||||||
|
|
||||||
newPatches[nPatches].name() = "xMin";
|
newPatches[nPatches].name() = "xMin";
|
||||||
newPatches[nPatches+1].name() = "xMax";
|
newPatches[nPatches+1].name() = "xMax";
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. 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.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
\\ / O peration | Version: 3.2
|
\\ / O peration |
|
||||||
\\ / A nd | Web: http://www.foam-extend.org
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
\\/ M anipulation | For copyright notice see file Copyright
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of foam-extend.
|
This file is part of cfMesh.
|
||||||
|
|
||||||
foam-extend is free software: you can redistribute it and/or modify it
|
cfMesh is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
Free Software Foundation; either version 3 of the License, or (at your
|
||||||
option) any later version.
|
option) any later version.
|
||||||
|
|
||||||
foam-extend is distributed in the hope that it will be useful, but
|
cfMesh is distributed in the hope that it will be useful, but WITHOUT
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
General Public License for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Application
|
Application
|
||||||
Generates tetrahedral mesh
|
Generates tetrahedral mesh
|
||||||
|
@ -30,8 +30,6 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "tetMeshGenerator.H"
|
#include "tetMeshGenerator.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
Binary file not shown.
|
@ -32,7 +32,6 @@ Description
|
||||||
#include "triSurfacePatchManipulator.H"
|
#include "triSurfacePatchManipulator.H"
|
||||||
#include "triSurfaceCleanupDuplicateTriangles.H"
|
#include "triSurfaceCleanupDuplicateTriangles.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
#include "foamTime.H"
|
|
||||||
#include "meshOctreeCreator.H"
|
#include "meshOctreeCreator.H"
|
||||||
#include "cartesianMeshExtractor.H"
|
#include "cartesianMeshExtractor.H"
|
||||||
#include "meshSurfaceEngine.H"
|
#include "meshSurfaceEngine.H"
|
||||||
|
@ -188,7 +187,7 @@ void cartesian2DMeshGenerator::refBoundaryLayers()
|
||||||
|
|
||||||
void cartesian2DMeshGenerator::replaceBoundaries()
|
void cartesian2DMeshGenerator::replaceBoundaries()
|
||||||
{
|
{
|
||||||
renameBoundaryPatches rbp(mesh_, meshDict_);
|
renameBoundaryPatches rbp(mesh_, meshDict_, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cartesian2DMeshGenerator::renumberMesh()
|
void cartesian2DMeshGenerator::renumberMesh()
|
||||||
|
@ -198,67 +197,53 @@ void cartesian2DMeshGenerator::renumberMesh()
|
||||||
|
|
||||||
void cartesian2DMeshGenerator::generateMesh()
|
void cartesian2DMeshGenerator::generateMesh()
|
||||||
{
|
{
|
||||||
try
|
if( controller_.runCurrentStep("templateGeneration") )
|
||||||
{
|
{
|
||||||
if( controller_.runCurrentStep("templateGeneration") )
|
createCartesianMesh();
|
||||||
{
|
|
||||||
createCartesianMesh();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("surfaceTopology") )
|
|
||||||
{
|
|
||||||
surfacePreparation();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("surfaceProjection") )
|
|
||||||
{
|
|
||||||
mapMeshToSurface();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("patchAssignment") )
|
|
||||||
{
|
|
||||||
extractPatches();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("edgeExtraction") )
|
|
||||||
{
|
|
||||||
mapEdgesAndCorners();
|
|
||||||
|
|
||||||
optimiseMeshSurface();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("boundaryLayerGeneration") )
|
|
||||||
{
|
|
||||||
generateBoundaryLayers();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("meshOptimisation") )
|
|
||||||
{
|
|
||||||
optimiseMeshSurface();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("boundaryLayerRefinement") )
|
|
||||||
{
|
|
||||||
refBoundaryLayers();
|
|
||||||
}
|
|
||||||
|
|
||||||
renumberMesh();
|
|
||||||
|
|
||||||
replaceBoundaries();
|
|
||||||
|
|
||||||
controller_.workflowCompleted();
|
|
||||||
}
|
}
|
||||||
catch(const std::string& message)
|
|
||||||
|
if( controller_.runCurrentStep("surfaceTopology") )
|
||||||
{
|
{
|
||||||
Info << message << endl;
|
surfacePreparation();
|
||||||
}
|
}
|
||||||
catch(...)
|
|
||||||
|
if( controller_.runCurrentStep("surfaceProjection") )
|
||||||
{
|
{
|
||||||
WarningIn
|
mapMeshToSurface();
|
||||||
(
|
|
||||||
"void cartesian2DMeshGenerator::generateMesh()"
|
|
||||||
) << "Meshing process terminated!" << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("patchAssignment") )
|
||||||
|
{
|
||||||
|
extractPatches();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("edgeExtraction") )
|
||||||
|
{
|
||||||
|
mapEdgesAndCorners();
|
||||||
|
|
||||||
|
optimiseMeshSurface();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("boundaryLayerGeneration") )
|
||||||
|
{
|
||||||
|
generateBoundaryLayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("meshOptimisation") )
|
||||||
|
{
|
||||||
|
optimiseMeshSurface();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("boundaryLayerRefinement") )
|
||||||
|
{
|
||||||
|
refBoundaryLayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
renumberMesh();
|
||||||
|
|
||||||
|
replaceBoundaries();
|
||||||
|
|
||||||
|
controller_.workflowCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
@ -283,70 +268,87 @@ cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time& time)
|
||||||
mesh_(time),
|
mesh_(time),
|
||||||
controller_(mesh_)
|
controller_(mesh_)
|
||||||
{
|
{
|
||||||
if( true )
|
try
|
||||||
{
|
{
|
||||||
checkMeshDict cmd(meshDict_);
|
if( true )
|
||||||
}
|
|
||||||
|
|
||||||
fileName surfaceFile = meshDict_.lookup("surfaceFile");
|
|
||||||
if( Pstream::parRun() )
|
|
||||||
surfaceFile = ".."/surfaceFile;
|
|
||||||
|
|
||||||
surfacePtr_ = new triSurf(db_.path()/surfaceFile);
|
|
||||||
|
|
||||||
if( true )
|
|
||||||
{
|
|
||||||
//- save meta data with the mesh (surface mesh + its topology info)
|
|
||||||
triSurfaceMetaData sMetaData(*surfacePtr_);
|
|
||||||
const dictionary& surfMetaDict = sMetaData.metaData();
|
|
||||||
|
|
||||||
mesh_.metaData().add("surfaceFile", surfaceFile, true);
|
|
||||||
mesh_.metaData().add("surfaceMeta", surfMetaDict, true);
|
|
||||||
|
|
||||||
triSurface2DCheck surfCheck(*surfacePtr_);
|
|
||||||
if( !surfCheck.is2DSurface() )
|
|
||||||
{
|
{
|
||||||
surfCheck.createSubsets();
|
checkMeshDict cmd(meshDict_);
|
||||||
|
|
||||||
Info << "Writting surface with subsets to file "
|
|
||||||
<< "badSurfaceWithSubsets.fms" << endl;
|
|
||||||
surfacePtr_->writeSurface("badSurfaceWithSubsets.fms");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( surfacePtr_->featureEdges().size() != 0 )
|
fileName surfaceFile = meshDict_.lookup("surfaceFile");
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
surfaceFile = ".."/surfaceFile;
|
||||||
|
|
||||||
|
surfacePtr_ = new triSurf(db_.path()/surfaceFile);
|
||||||
|
|
||||||
|
if( true )
|
||||||
|
{
|
||||||
|
//- save meta data with the mesh (surface mesh + its topology info)
|
||||||
|
triSurfaceMetaData sMetaData(*surfacePtr_);
|
||||||
|
const dictionary& surfMetaDict = sMetaData.metaData();
|
||||||
|
|
||||||
|
mesh_.metaData().add("surfaceFile", surfaceFile, true);
|
||||||
|
mesh_.metaData().add("surfaceMeta", surfMetaDict, true);
|
||||||
|
|
||||||
|
triSurface2DCheck surfCheck(*surfacePtr_);
|
||||||
|
if( !surfCheck.is2DSurface() )
|
||||||
|
{
|
||||||
|
surfCheck.createSubsets();
|
||||||
|
|
||||||
|
Info << "Writting surface with subsets to file "
|
||||||
|
<< "badSurfaceWithSubsets.fms" << endl;
|
||||||
|
surfacePtr_->writeSurface("badSurfaceWithSubsets.fms");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( surfacePtr_->featureEdges().size() != 0 )
|
||||||
|
{
|
||||||
|
//- get rid of duplicate triangles as they cause strange problems
|
||||||
|
triSurfaceCleanupDuplicateTriangles
|
||||||
|
(
|
||||||
|
const_cast<triSurf&>(*surfacePtr_)
|
||||||
|
);
|
||||||
|
|
||||||
|
//- create surface patches based on the feature edges
|
||||||
|
//- and update the meshDict based on the given data
|
||||||
|
triSurfacePatchManipulator manipulator(*surfacePtr_);
|
||||||
|
|
||||||
|
const triSurf* surfaceWithPatches =
|
||||||
|
manipulator.surfaceWithPatches(&meshDict_);
|
||||||
|
|
||||||
|
//- delete the old surface and assign the new one
|
||||||
|
deleteDemandDrivenData(surfacePtr_);
|
||||||
|
surfacePtr_ = surfaceWithPatches;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( meshDict_.found("anisotropicSources") )
|
||||||
|
{
|
||||||
|
surfaceMeshGeometryModification surfMod(*surfacePtr_, meshDict_);
|
||||||
|
|
||||||
|
modSurfacePtr_ = surfMod.modifyGeometry();
|
||||||
|
|
||||||
|
octreePtr_ = new meshOctree(*modSurfacePtr_, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
octreePtr_ = new meshOctree(*surfacePtr_, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
|
||||||
|
|
||||||
|
generateMesh();
|
||||||
|
}
|
||||||
|
catch(const std::string& message)
|
||||||
{
|
{
|
||||||
//- get rid of duplicate triangles as they cause strange problems
|
Info << message << endl;
|
||||||
triSurfaceCleanupDuplicateTriangles(const_cast<triSurf&>(*surfacePtr_));
|
|
||||||
|
|
||||||
//- create surface patches based on the feature edges
|
|
||||||
//- and update the meshDict based on the given data
|
|
||||||
triSurfacePatchManipulator manipulator(*surfacePtr_);
|
|
||||||
|
|
||||||
const triSurf* surfaceWithPatches =
|
|
||||||
manipulator.surfaceWithPatches(&meshDict_);
|
|
||||||
|
|
||||||
//- delete the old surface and assign the new one
|
|
||||||
deleteDemandDrivenData(surfacePtr_);
|
|
||||||
surfacePtr_ = surfaceWithPatches;
|
|
||||||
}
|
}
|
||||||
|
catch(...)
|
||||||
if( meshDict_.found("anisotropicSources") )
|
|
||||||
{
|
{
|
||||||
surfaceMeshGeometryModification surfMod(*surfacePtr_, meshDict_);
|
WarningIn
|
||||||
|
(
|
||||||
modSurfacePtr_ = surfMod.modifyGeometry();
|
"cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time&)"
|
||||||
|
) << "Meshing process terminated!" << endl;
|
||||||
octreePtr_ = new meshOctree(*modSurfacePtr_, true);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
octreePtr_ = new meshOctree(*surfacePtr_, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
|
|
||||||
|
|
||||||
generateMesh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
};
|
};
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -418,8 +418,8 @@ void cartesianMeshExtractor::createPolyMesh()
|
||||||
newFacePatch
|
newFacePatch
|
||||||
);
|
);
|
||||||
|
|
||||||
meshModifier.boundariesAccess()[1].patchType() = "patch";
|
meshModifier.boundariesAccess()[1].patchType() = "empty";
|
||||||
meshModifier.boundariesAccess()[2].patchType() = "patch";
|
meshModifier.boundariesAccess()[2].patchType() = "empty";
|
||||||
}
|
}
|
||||||
|
|
||||||
Info << "Finished creating polyMesh" << endl;
|
Info << "Finished creating polyMesh" << endl;
|
||||||
|
|
|
@ -29,7 +29,6 @@ Description
|
||||||
#include "triSurf.H"
|
#include "triSurf.H"
|
||||||
#include "triSurfacePatchManipulator.H"
|
#include "triSurfacePatchManipulator.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
#include "foamTime.H"
|
|
||||||
#include "meshOctreeCreator.H"
|
#include "meshOctreeCreator.H"
|
||||||
#include "cartesianMeshExtractor.H"
|
#include "cartesianMeshExtractor.H"
|
||||||
#include "meshSurfaceEngine.H"
|
#include "meshSurfaceEngine.H"
|
||||||
|
@ -247,69 +246,55 @@ void cartesianMeshGenerator::renumberMesh()
|
||||||
|
|
||||||
void cartesianMeshGenerator::generateMesh()
|
void cartesianMeshGenerator::generateMesh()
|
||||||
{
|
{
|
||||||
try
|
if( controller_.runCurrentStep("templateGeneration") )
|
||||||
{
|
{
|
||||||
if( controller_.runCurrentStep("templateGeneration") )
|
createCartesianMesh();
|
||||||
{
|
|
||||||
createCartesianMesh();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("surfaceTopology") )
|
|
||||||
{
|
|
||||||
surfacePreparation();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("surfaceProjection") )
|
|
||||||
{
|
|
||||||
mapMeshToSurface();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("patchAssignment") )
|
|
||||||
{
|
|
||||||
extractPatches();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("edgeExtraction") )
|
|
||||||
{
|
|
||||||
mapEdgesAndCorners();
|
|
||||||
|
|
||||||
optimiseMeshSurface();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("boundaryLayerGeneration") )
|
|
||||||
{
|
|
||||||
generateBoundaryLayers();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("meshOptimisation") )
|
|
||||||
{
|
|
||||||
optimiseFinalMesh();
|
|
||||||
|
|
||||||
projectSurfaceAfterBackScaling();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("boundaryLayerRefinement") )
|
|
||||||
{
|
|
||||||
refBoundaryLayers();
|
|
||||||
}
|
|
||||||
|
|
||||||
renumberMesh();
|
|
||||||
|
|
||||||
replaceBoundaries();
|
|
||||||
|
|
||||||
controller_.workflowCompleted();
|
|
||||||
}
|
}
|
||||||
catch(const std::string& message)
|
|
||||||
|
if( controller_.runCurrentStep("surfaceTopology") )
|
||||||
{
|
{
|
||||||
Info << message << endl;
|
surfacePreparation();
|
||||||
}
|
}
|
||||||
catch(...)
|
|
||||||
|
if( controller_.runCurrentStep("surfaceProjection") )
|
||||||
{
|
{
|
||||||
WarningIn
|
mapMeshToSurface();
|
||||||
(
|
|
||||||
"void cartesianMeshGenerator::generateMesh()"
|
|
||||||
) << "Meshing process terminated!" << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("patchAssignment") )
|
||||||
|
{
|
||||||
|
extractPatches();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("edgeExtraction") )
|
||||||
|
{
|
||||||
|
mapEdgesAndCorners();
|
||||||
|
|
||||||
|
optimiseMeshSurface();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("boundaryLayerGeneration") )
|
||||||
|
{
|
||||||
|
generateBoundaryLayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("meshOptimisation") )
|
||||||
|
{
|
||||||
|
optimiseFinalMesh();
|
||||||
|
|
||||||
|
projectSurfaceAfterBackScaling();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("boundaryLayerRefinement") )
|
||||||
|
{
|
||||||
|
refBoundaryLayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
renumberMesh();
|
||||||
|
|
||||||
|
replaceBoundaries();
|
||||||
|
|
||||||
|
controller_.workflowCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
@ -334,57 +319,72 @@ cartesianMeshGenerator::cartesianMeshGenerator(const Time& time)
|
||||||
mesh_(time),
|
mesh_(time),
|
||||||
controller_(mesh_)
|
controller_(mesh_)
|
||||||
{
|
{
|
||||||
if( true )
|
try
|
||||||
{
|
{
|
||||||
checkMeshDict cmd(meshDict_);
|
if( true )
|
||||||
|
{
|
||||||
|
checkMeshDict cmd(meshDict_);
|
||||||
|
}
|
||||||
|
|
||||||
|
fileName surfaceFile = meshDict_.lookup("surfaceFile");
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
surfaceFile = ".."/surfaceFile;
|
||||||
|
|
||||||
|
surfacePtr_ = new triSurf(db_.path()/surfaceFile);
|
||||||
|
|
||||||
|
if( true )
|
||||||
|
{
|
||||||
|
//- save meta data with the mesh (surface mesh + its topology info)
|
||||||
|
triSurfaceMetaData sMetaData(*surfacePtr_);
|
||||||
|
const dictionary& surfMetaDict = sMetaData.metaData();
|
||||||
|
|
||||||
|
mesh_.metaData().add("surfaceFile", surfaceFile, true);
|
||||||
|
mesh_.metaData().add("surfaceMeta", surfMetaDict, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( surfacePtr_->featureEdges().size() != 0 )
|
||||||
|
{
|
||||||
|
//- create surface patches based on the feature edges
|
||||||
|
//- and update the meshDict based on the given data
|
||||||
|
triSurfacePatchManipulator manipulator(*surfacePtr_);
|
||||||
|
|
||||||
|
const triSurf* surfaceWithPatches =
|
||||||
|
manipulator.surfaceWithPatches(&meshDict_);
|
||||||
|
|
||||||
|
//- delete the old surface and assign the new one
|
||||||
|
deleteDemandDrivenData(surfacePtr_);
|
||||||
|
surfacePtr_ = surfaceWithPatches;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( meshDict_.found("anisotropicSources") )
|
||||||
|
{
|
||||||
|
surfaceMeshGeometryModification surfMod(*surfacePtr_, meshDict_);
|
||||||
|
|
||||||
|
modSurfacePtr_ = surfMod.modifyGeometry();
|
||||||
|
|
||||||
|
octreePtr_ = new meshOctree(*modSurfacePtr_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
octreePtr_ = new meshOctree(*surfacePtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
|
||||||
|
|
||||||
|
generateMesh();
|
||||||
}
|
}
|
||||||
|
catch(const std::string& message)
|
||||||
fileName surfaceFile = meshDict_.lookup("surfaceFile");
|
|
||||||
if( Pstream::parRun() )
|
|
||||||
surfaceFile = ".."/surfaceFile;
|
|
||||||
|
|
||||||
surfacePtr_ = new triSurf(db_.path()/surfaceFile);
|
|
||||||
|
|
||||||
if( true )
|
|
||||||
{
|
{
|
||||||
//- save meta data with the mesh (surface mesh + its topology info)
|
Info << "Here" << endl;
|
||||||
triSurfaceMetaData sMetaData(*surfacePtr_);
|
Info << message << endl;
|
||||||
const dictionary& surfMetaDict = sMetaData.metaData();
|
|
||||||
|
|
||||||
mesh_.metaData().add("surfaceFile", surfaceFile, true);
|
|
||||||
mesh_.metaData().add("surfaceMeta", surfMetaDict, true);
|
|
||||||
}
|
}
|
||||||
|
catch(...)
|
||||||
if( surfacePtr_->featureEdges().size() != 0 )
|
|
||||||
{
|
{
|
||||||
//- create surface patches based on the feature edges
|
WarningIn
|
||||||
//- and update the meshDict based on the given data
|
(
|
||||||
triSurfacePatchManipulator manipulator(*surfacePtr_);
|
"cartesianMeshGenerator::cartesianMeshGenerator(const Time&)"
|
||||||
|
) << "Meshing process terminated!" << endl;
|
||||||
const triSurf* surfaceWithPatches =
|
|
||||||
manipulator.surfaceWithPatches(&meshDict_);
|
|
||||||
|
|
||||||
//- delete the old surface and assign the new one
|
|
||||||
deleteDemandDrivenData(surfacePtr_);
|
|
||||||
surfacePtr_ = surfaceWithPatches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( meshDict_.found("anisotropicSources") )
|
|
||||||
{
|
|
||||||
surfaceMeshGeometryModification surfMod(*surfacePtr_, meshDict_);
|
|
||||||
|
|
||||||
modSurfacePtr_ = surfMod.modifyGeometry();
|
|
||||||
|
|
||||||
octreePtr_ = new meshOctree(*modSurfacePtr_);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
octreePtr_ = new meshOctree(*surfacePtr_);
|
|
||||||
}
|
|
||||||
|
|
||||||
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
|
|
||||||
|
|
||||||
generateMesh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
|
@ -28,7 +28,6 @@ Description
|
||||||
#include "tetMeshGenerator.H"
|
#include "tetMeshGenerator.H"
|
||||||
#include "triSurf.H"
|
#include "triSurf.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
#include "foamTime.H"
|
|
||||||
#include "meshOctreeCreator.H"
|
#include "meshOctreeCreator.H"
|
||||||
#include "tetMeshExtractorOctree.H"
|
#include "tetMeshExtractorOctree.H"
|
||||||
#include "meshSurfaceEngine.H"
|
#include "meshSurfaceEngine.H"
|
||||||
|
@ -235,69 +234,55 @@ void tetMeshGenerator::renumberMesh()
|
||||||
|
|
||||||
void tetMeshGenerator::generateMesh()
|
void tetMeshGenerator::generateMesh()
|
||||||
{
|
{
|
||||||
try
|
if( controller_.runCurrentStep("templateGeneration") )
|
||||||
{
|
{
|
||||||
if( controller_.runCurrentStep("templateGeneration") )
|
createTetMesh();
|
||||||
{
|
|
||||||
createTetMesh();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("surfaceTopology") )
|
|
||||||
{
|
|
||||||
surfacePreparation();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("surfaceProjection") )
|
|
||||||
{
|
|
||||||
mapMeshToSurface();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("patchAssignment") )
|
|
||||||
{
|
|
||||||
extractPatches();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("edgeExtraction") )
|
|
||||||
{
|
|
||||||
mapEdgesAndCorners();
|
|
||||||
|
|
||||||
optimiseMeshSurface();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("boundaryLayerGeneration") )
|
|
||||||
{
|
|
||||||
generateBoundaryLayers();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("meshOptimisation") )
|
|
||||||
{
|
|
||||||
optimiseFinalMesh();
|
|
||||||
|
|
||||||
projectSurfaceAfterBackScaling();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( controller_.runCurrentStep("boundaryLayerRefinement") )
|
|
||||||
{
|
|
||||||
refBoundaryLayers();
|
|
||||||
}
|
|
||||||
|
|
||||||
renumberMesh();
|
|
||||||
|
|
||||||
replaceBoundaries();
|
|
||||||
|
|
||||||
controller_.workflowCompleted();
|
|
||||||
}
|
}
|
||||||
catch(const std::string& message)
|
|
||||||
|
if( controller_.runCurrentStep("surfaceTopology") )
|
||||||
{
|
{
|
||||||
Info << message << endl;
|
surfacePreparation();
|
||||||
}
|
}
|
||||||
catch(...)
|
|
||||||
|
if( controller_.runCurrentStep("surfaceProjection") )
|
||||||
{
|
{
|
||||||
WarningIn
|
mapMeshToSurface();
|
||||||
(
|
|
||||||
"void tetMeshGenerator::generateMesh()"
|
|
||||||
) << "Meshing process terminated!" << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("patchAssignment") )
|
||||||
|
{
|
||||||
|
extractPatches();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("edgeExtraction") )
|
||||||
|
{
|
||||||
|
mapEdgesAndCorners();
|
||||||
|
|
||||||
|
optimiseMeshSurface();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("boundaryLayerGeneration") )
|
||||||
|
{
|
||||||
|
generateBoundaryLayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("meshOptimisation") )
|
||||||
|
{
|
||||||
|
optimiseFinalMesh();
|
||||||
|
|
||||||
|
projectSurfaceAfterBackScaling();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( controller_.runCurrentStep("boundaryLayerRefinement") )
|
||||||
|
{
|
||||||
|
refBoundaryLayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
renumberMesh();
|
||||||
|
|
||||||
|
replaceBoundaries();
|
||||||
|
|
||||||
|
controller_.workflowCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
@ -323,55 +308,69 @@ tetMeshGenerator::tetMeshGenerator(const Time& time)
|
||||||
mesh_(time),
|
mesh_(time),
|
||||||
controller_(mesh_)
|
controller_(mesh_)
|
||||||
{
|
{
|
||||||
if( true )
|
try
|
||||||
{
|
{
|
||||||
checkMeshDict cmd(meshDict_);
|
if( true )
|
||||||
|
{
|
||||||
|
checkMeshDict cmd(meshDict_);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileName surfaceFile = meshDict_.lookup("surfaceFile");
|
||||||
|
|
||||||
|
surfacePtr_ = new triSurf(runTime_.path()/surfaceFile);
|
||||||
|
|
||||||
|
if( true )
|
||||||
|
{
|
||||||
|
//- save meta data with the mesh (surface mesh + its topology info)
|
||||||
|
triSurfaceMetaData sMetaData(*surfacePtr_);
|
||||||
|
const dictionary& surfMetaDict = sMetaData.metaData();
|
||||||
|
|
||||||
|
mesh_.metaData().add("surfaceFile", surfaceFile, true);
|
||||||
|
mesh_.metaData().add("surfaceMeta", surfMetaDict, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( surfacePtr_->featureEdges().size() != 0 )
|
||||||
|
{
|
||||||
|
//- create surface patches based on the feature edges
|
||||||
|
//- and update the meshDict based on the given data
|
||||||
|
triSurfacePatchManipulator manipulator(*surfacePtr_);
|
||||||
|
|
||||||
|
const triSurf* surfaceWithPatches =
|
||||||
|
manipulator.surfaceWithPatches(&meshDict_);
|
||||||
|
|
||||||
|
//- delete the old surface and assign the new one
|
||||||
|
deleteDemandDrivenData(surfacePtr_);
|
||||||
|
surfacePtr_ = surfaceWithPatches;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( meshDict_.found("anisotropicSources") )
|
||||||
|
{
|
||||||
|
surfaceMeshGeometryModification surfMod(*surfacePtr_, meshDict_);
|
||||||
|
|
||||||
|
modSurfacePtr_ = surfMod.modifyGeometry();
|
||||||
|
|
||||||
|
octreePtr_ = new meshOctree(*modSurfacePtr_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
octreePtr_ = new meshOctree(*surfacePtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
|
||||||
|
|
||||||
|
generateMesh();
|
||||||
}
|
}
|
||||||
|
catch(const std::string& message)
|
||||||
const fileName surfaceFile = meshDict_.lookup("surfaceFile");
|
|
||||||
|
|
||||||
surfacePtr_ = new triSurf(runTime_.path()/surfaceFile);
|
|
||||||
|
|
||||||
if( true )
|
|
||||||
{
|
{
|
||||||
//- save meta data with the mesh (surface mesh + its topology info)
|
Info << message << endl;
|
||||||
triSurfaceMetaData sMetaData(*surfacePtr_);
|
|
||||||
const dictionary& surfMetaDict = sMetaData.metaData();
|
|
||||||
|
|
||||||
mesh_.metaData().add("surfaceFile", surfaceFile, true);
|
|
||||||
mesh_.metaData().add("surfaceMeta", surfMetaDict, true);
|
|
||||||
}
|
}
|
||||||
|
catch(...)
|
||||||
if( surfacePtr_->featureEdges().size() != 0 )
|
|
||||||
{
|
{
|
||||||
//- create surface patches based on the feature edges
|
WarningIn
|
||||||
//- and update the meshDict based on the given data
|
(
|
||||||
triSurfacePatchManipulator manipulator(*surfacePtr_);
|
"tetMeshGenerator::tetMeshGenerator(const Time&)"
|
||||||
|
) << "Meshing process terminated!" << endl;
|
||||||
const triSurf* surfaceWithPatches =
|
|
||||||
manipulator.surfaceWithPatches(&meshDict_);
|
|
||||||
|
|
||||||
//- delete the old surface and assign the new one
|
|
||||||
deleteDemandDrivenData(surfacePtr_);
|
|
||||||
surfacePtr_ = surfaceWithPatches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( meshDict_.found("anisotropicSources") )
|
|
||||||
{
|
|
||||||
surfaceMeshGeometryModification surfMod(*surfacePtr_, meshDict_);
|
|
||||||
|
|
||||||
modSurfacePtr_ = surfMod.modifyGeometry();
|
|
||||||
|
|
||||||
octreePtr_ = new meshOctree(*modSurfacePtr_);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
octreePtr_ = new meshOctree(*surfacePtr_);
|
|
||||||
}
|
|
||||||
|
|
||||||
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
|
|
||||||
|
|
||||||
generateMesh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
|
@ -176,7 +176,7 @@ void boxScaling::boundingPlanes(PtrList<plane>&pl) const
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
dictionary boxScaling::dict(bool ignoreType) const
|
dictionary boxScaling::dict(bool /*ignoreType*/) const
|
||||||
{
|
{
|
||||||
dictionary dict;
|
dictionary dict;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ coordinateModification::coordinateModification()
|
||||||
coordinateModification::coordinateModification
|
coordinateModification::coordinateModification
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const dictionary& dict
|
const dictionary& /*dict*/
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name)
|
name_(name)
|
||||||
|
|
|
@ -36,8 +36,6 @@ SourceFiles
|
||||||
#ifndef coordinateModifier_H
|
#ifndef coordinateModifier_H
|
||||||
#define coordinateModifier_H
|
#define coordinateModifier_H
|
||||||
|
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "word.H"
|
#include "word.H"
|
||||||
#include "point.H"
|
#include "point.H"
|
||||||
#include "coordinateModificationList.H"
|
#include "coordinateModificationList.H"
|
||||||
|
|
|
@ -153,7 +153,7 @@ void planeScaling::boundingPlanes(PtrList<plane>& pl) const
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
dictionary planeScaling::dict(bool ignoreType) const
|
dictionary planeScaling::dict(bool /*ignoreType*/) const
|
||||||
{
|
{
|
||||||
dictionary dict;
|
dictionary dict;
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,6 @@ SourceFiles
|
||||||
#ifndef boundaryLayers_H
|
#ifndef boundaryLayers_H
|
||||||
#define boundaryLayers_H
|
#define boundaryLayers_H
|
||||||
|
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "polyMeshGenModifier.H"
|
#include "polyMeshGenModifier.H"
|
||||||
#include "meshSurfaceEngine.H"
|
#include "meshSurfaceEngine.H"
|
||||||
#include "meshSurfacePartitioner.H"
|
#include "meshSurfacePartitioner.H"
|
||||||
|
|
|
@ -686,7 +686,7 @@ void boundaryLayers::createNewPartitionVerticesParallel
|
||||||
(
|
(
|
||||||
const labelLongList& procPoints,
|
const labelLongList& procPoints,
|
||||||
const List<direction>& pVertices,
|
const List<direction>& pVertices,
|
||||||
const boolList& treatPatches
|
const boolList& /*treatPatches*/
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if( !Pstream::parRun() )
|
if( !Pstream::parRun() )
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -374,7 +374,7 @@ void extrudeLayer::createNewVertices()
|
||||||
|
|
||||||
OPstream toOtherProc
|
OPstream toOtherProc
|
||||||
(
|
(
|
||||||
Pstream::blocking,
|
Pstream::commsTypes::blocking,
|
||||||
procBoundaries[patchI].neiProcNo(),
|
procBoundaries[patchI].neiProcNo(),
|
||||||
globalLabels.byteSize()
|
globalLabels.byteSize()
|
||||||
);
|
);
|
||||||
|
@ -390,7 +390,7 @@ void extrudeLayer::createNewVertices()
|
||||||
labelList receivedData;
|
labelList receivedData;
|
||||||
IPstream fromOtherProc
|
IPstream fromOtherProc
|
||||||
(
|
(
|
||||||
Pstream::blocking,
|
Pstream::commsTypes::blocking,
|
||||||
procBoundaries[patchI].neiProcNo()
|
procBoundaries[patchI].neiProcNo()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ void extrudeLayer::createNewVertices()
|
||||||
|
|
||||||
DynList<label> edgeGroup;
|
DynList<label> edgeGroup;
|
||||||
edgeGroup.setSize(dEdges.size());
|
edgeGroup.setSize(dEdges.size());
|
||||||
edgeGroup = -1;
|
edgeGroup = label(-1);
|
||||||
|
|
||||||
//- check edge connections and store all edges which can be reached
|
//- check edge connections and store all edges which can be reached
|
||||||
//- over other edges into the same group
|
//- over other edges into the same group
|
||||||
|
@ -538,7 +538,7 @@ void extrudeLayer::createNewVertices()
|
||||||
//- find face groups from the groups assigned to dual edges
|
//- find face groups from the groups assigned to dual edges
|
||||||
DynList<label> faceGroups;
|
DynList<label> faceGroups;
|
||||||
faceGroups.setSize(pointFaces.sizeOfRow(pointI));
|
faceGroups.setSize(pointFaces.sizeOfRow(pointI));
|
||||||
faceGroups = -1;
|
faceGroups = label(-1);
|
||||||
|
|
||||||
forAllRow(pointFaces, pointI, pfI)
|
forAllRow(pointFaces, pointI, pfI)
|
||||||
{
|
{
|
||||||
|
@ -618,7 +618,7 @@ void extrudeLayer::createNewVertices()
|
||||||
//- assign groups to faces and cells
|
//- assign groups to faces and cells
|
||||||
DynList<label> faceGroup;
|
DynList<label> faceGroup;
|
||||||
faceGroup.setSize(pointFaces.sizeOfRow(pointI));
|
faceGroup.setSize(pointFaces.sizeOfRow(pointI));
|
||||||
faceGroup = -1;
|
faceGroup = label(-1);
|
||||||
|
|
||||||
label group(0);
|
label group(0);
|
||||||
|
|
||||||
|
@ -1114,7 +1114,7 @@ void extrudeLayer::createLayerCells()
|
||||||
//- find labels of points
|
//- find labels of points
|
||||||
DynList<label> origFacePoints;
|
DynList<label> origFacePoints;
|
||||||
origFacePoints.setSize(pointFaces.sizeOfRow(pointI));
|
origFacePoints.setSize(pointFaces.sizeOfRow(pointI));
|
||||||
origFacePoints = -1;
|
origFacePoints = label(-1);
|
||||||
|
|
||||||
forAllRow(pointFaces, pointI, pfI)
|
forAllRow(pointFaces, pointI, pfI)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,8 +36,6 @@ SourceFiles
|
||||||
#ifndef extrudeLayer_H
|
#ifndef extrudeLayer_H
|
||||||
#define extrudeLayer_H
|
#define extrudeLayer_H
|
||||||
|
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "polyMeshGenModifier.H"
|
#include "polyMeshGenModifier.H"
|
||||||
#include "VRWGraphList.H"
|
#include "VRWGraphList.H"
|
||||||
#include "labelPair.H"
|
#include "labelPair.H"
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,6 @@ SourceFiles
|
||||||
#ifndef refineBoundaryLayers_H
|
#ifndef refineBoundaryLayers_H
|
||||||
#define refineBoundaryLayers_H
|
#define refineBoundaryLayers_H
|
||||||
|
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "polyMeshGenModifier.H"
|
#include "polyMeshGenModifier.H"
|
||||||
#include "meshSurfaceEngine.H"
|
#include "meshSurfaceEngine.H"
|
||||||
#include "DynList.H"
|
#include "DynList.H"
|
||||||
|
|
|
@ -885,7 +885,7 @@ void refineBoundaryLayers::refineCornerHexCell::generateNewPoints()
|
||||||
forAll(cellPoints_[i], j)
|
forAll(cellPoints_[i], j)
|
||||||
{
|
{
|
||||||
cellPoints_[i][j].setSize(nLayersK_+1);
|
cellPoints_[i][j].setSize(nLayersK_+1);
|
||||||
cellPoints_[i][j] = -1;
|
cellPoints_[i][j] = label(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ void refineBoundaryLayers::refineFace
|
||||||
forAll(facePoints, i)
|
forAll(facePoints, i)
|
||||||
{
|
{
|
||||||
facePoints[i].setSize(nLayersDir1+1);
|
facePoints[i].setSize(nLayersDir1+1);
|
||||||
facePoints[i] = -1;
|
facePoints[i] = label(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- add points in the matrix
|
//- add points in the matrix
|
||||||
|
@ -1049,7 +1049,7 @@ void refineBoundaryLayers::generateNewFaces()
|
||||||
|
|
||||||
OPstream toOtherProc
|
OPstream toOtherProc
|
||||||
(
|
(
|
||||||
Pstream::blocking,
|
Pstream::commsTypes::blocking,
|
||||||
procBoundaries[patchI].neiProcNo(),
|
procBoundaries[patchI].neiProcNo(),
|
||||||
sendData.byteSize()
|
sendData.byteSize()
|
||||||
);
|
);
|
||||||
|
@ -1065,7 +1065,7 @@ void refineBoundaryLayers::generateNewFaces()
|
||||||
|
|
||||||
IPstream fromOtherProc
|
IPstream fromOtherProc
|
||||||
(
|
(
|
||||||
Pstream::blocking,
|
Pstream::commsTypes::blocking,
|
||||||
procBoundaries[patchI].neiProcNo()
|
procBoundaries[patchI].neiProcNo()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ bool refineBoundaryLayers::analyseLayers()
|
||||||
{
|
{
|
||||||
if( allZMin[patchI] ^ allZMax[patchI] )
|
if( allZMin[patchI] ^ allZMax[patchI] )
|
||||||
{
|
{
|
||||||
nLayersAtPatch[patchI] = -1;
|
nLayersAtPatch[patchI] = label(-1);
|
||||||
layerAtPatch_[patchI].clear();
|
layerAtPatch_[patchI].clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -599,7 +599,7 @@ void refineBoundaryLayers::generateNewVertices()
|
||||||
//- on edges of the mesh
|
//- on edges of the mesh
|
||||||
DynList<label> numPointsAtThread;
|
DynList<label> numPointsAtThread;
|
||||||
numPointsAtThread.setSize(nThreads);
|
numPointsAtThread.setSize(nThreads);
|
||||||
numPointsAtThread = 0;
|
numPointsAtThread = label(0);
|
||||||
|
|
||||||
# ifdef USE_OMP
|
# ifdef USE_OMP
|
||||||
# pragma omp parallel for num_threads(nThreads) schedule(static, 1)
|
# pragma omp parallel for num_threads(nThreads) schedule(static, 1)
|
||||||
|
|
|
@ -36,8 +36,6 @@ SourceFiles
|
||||||
#ifndef triangulateNonPlanarBaseFaces_H
|
#ifndef triangulateNonPlanarBaseFaces_H
|
||||||
#define triangulateNonPlanarBaseFaces_H
|
#define triangulateNonPlanarBaseFaces_H
|
||||||
|
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "polyMeshGenModifier.H"
|
#include "polyMeshGenModifier.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
|
@ -764,6 +764,54 @@ void checkMeshDict::checkRenameBoundary() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Mesh quality criteria specified by the user
|
||||||
|
void checkMeshDict::checkQualitySettings() const
|
||||||
|
{
|
||||||
|
|
||||||
|
if( meshDict_.found("meshQualitySettings") )
|
||||||
|
{
|
||||||
|
const dictionary& qualityDict = meshDict_.subDict("meshQualitySettings");
|
||||||
|
|
||||||
|
//- read maximum non-orthogonality defined by the user
|
||||||
|
if( qualityDict.found("maxNonOrthogonality") )
|
||||||
|
{
|
||||||
|
readScalar(qualityDict.lookup("maxNonOrthogonality"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- read maximum skewness defined by the user
|
||||||
|
if( qualityDict.found("maxSkewness") )
|
||||||
|
{
|
||||||
|
readScalar(qualityDict.lookup("maxSkewness"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- read minimum volume of the face pyramid defined by the user
|
||||||
|
if( qualityDict.found("minPyramidVolume") )
|
||||||
|
{
|
||||||
|
readScalar(qualityDict.lookup("minPyramidVolume"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- read face flatness defined by the user
|
||||||
|
if( qualityDict.found("faceFlatness") )
|
||||||
|
{
|
||||||
|
readScalar(qualityDict.lookup("faceFlatness"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- read minimum tetrahedral part of a cell defined by the user
|
||||||
|
if( qualityDict.found("minCellPartTetrahedra") )
|
||||||
|
{
|
||||||
|
readScalar(qualityDict.lookup("minCellPartTetrahedra"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- read minimum area of a face defined by the user
|
||||||
|
if( qualityDict.found("minimumFaceArea") )
|
||||||
|
{
|
||||||
|
readScalar(qualityDict.lookup("minimumFaceArea"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void checkMeshDict::checkEntries() const
|
void checkMeshDict::checkEntries() const
|
||||||
{
|
{
|
||||||
checkBasicSettings();
|
checkBasicSettings();
|
||||||
|
@ -785,6 +833,8 @@ void checkMeshDict::checkEntries() const
|
||||||
checkBoundaryLayers();
|
checkBoundaryLayers();
|
||||||
|
|
||||||
checkRenameBoundary();
|
checkRenameBoundary();
|
||||||
|
|
||||||
|
checkQualitySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkMeshDict::updatePatchCellSize
|
void checkMeshDict::updatePatchCellSize
|
||||||
|
@ -860,7 +910,7 @@ void checkMeshDict::updatePatchCellSize
|
||||||
|
|
||||||
void checkMeshDict::updateSubsetCellSize
|
void checkMeshDict::updateSubsetCellSize
|
||||||
(
|
(
|
||||||
const std::map<word, wordList>& patchesFromPatch
|
const std::map<word, wordList>& /*patchesFromPatch*/
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1028,7 +1078,7 @@ void checkMeshDict::updateRemoveCellsIntersectingPatches
|
||||||
|
|
||||||
void checkMeshDict::updateObjectRefinements
|
void checkMeshDict::updateObjectRefinements
|
||||||
(
|
(
|
||||||
const std::map<word, wordList>& patchesFromPatch
|
const std::map<word, wordList>& /*patchesFromPatch*/
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,6 @@ SourceFiles
|
||||||
#ifndef checkMeshDict_H
|
#ifndef checkMeshDict_H
|
||||||
#define checkMeshDict_H
|
#define checkMeshDict_H
|
||||||
|
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "IOdictionary.H"
|
#include "IOdictionary.H"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -92,6 +90,9 @@ class checkMeshDict
|
||||||
//- check renameBoundary entry
|
//- check renameBoundary entry
|
||||||
void checkRenameBoundary() const;
|
void checkRenameBoundary() const;
|
||||||
|
|
||||||
|
//- check entry for mesh quality
|
||||||
|
void checkQualitySettings() const;
|
||||||
|
|
||||||
//- perform all checks
|
//- perform all checks
|
||||||
void checkEntries() const;
|
void checkEntries() const;
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,11 @@ License
|
||||||
|
|
||||||
// Construct from Istream
|
// Construct from Istream
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
Foam::DynList<T, staticSize>::DynList(Istream& is)
|
Foam::DynList<T, staticSize>::DynList(Istream&)
|
||||||
:
|
:
|
||||||
UList<T>(),
|
dataPtr_(nullptr),
|
||||||
|
nAllocated_(0),
|
||||||
|
staticData_(),
|
||||||
nextFree_(0)
|
nextFree_(0)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
|
@ -39,11 +41,6 @@ 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);
|
|
||||||
|
|
||||||
nextFree_ = helper.size();
|
|
||||||
UList<T>::swap(helper);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +51,7 @@ Foam::Ostream& Foam::operator<<
|
||||||
const Foam::DynList<T, staticSize>& DL
|
const Foam::DynList<T, staticSize>& DL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UList<T> helper(const_cast<T*>(DL.begin()), DL.nextFree_);
|
UList<T> helper(DL.dataPtr_, DL.nextFree_);
|
||||||
os << helper;
|
os << helper;
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
|
@ -75,8 +72,10 @@ Foam::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);
|
UList<T> helper(DL.dataPtr_, DL.nextFree_);
|
||||||
DL.nextFree_ = DL.List<T>::size();
|
//is >> static_cast<List<T>&>(DL);
|
||||||
|
is >> helper;
|
||||||
|
DL.nextFree_ = helper.size();
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,10 +73,14 @@ Istream& operator>>
|
||||||
|
|
||||||
template<class T, label staticSize = 16>
|
template<class T, label staticSize = 16>
|
||||||
class DynList
|
class DynList
|
||||||
:
|
|
||||||
public UList<T>
|
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
//- pointer to the data
|
||||||
|
T* dataPtr_;
|
||||||
|
|
||||||
|
//- size of the allocated data
|
||||||
|
label nAllocated_;
|
||||||
|
|
||||||
//- statically allocated data (used for short lists)
|
//- statically allocated data (used for short lists)
|
||||||
T staticData_[staticSize];
|
T staticData_[staticSize];
|
||||||
|
|
||||||
|
@ -84,12 +88,21 @@ class DynList
|
||||||
label nextFree_;
|
label nextFree_;
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
|
//- access to the data pointer
|
||||||
|
inline T* data();
|
||||||
|
|
||||||
|
//- const access to the data pointer
|
||||||
|
inline const T* data() const;
|
||||||
|
|
||||||
//- allocate list size
|
//- allocate list size
|
||||||
inline void allocateSize(const label);
|
inline void allocateSize(const label);
|
||||||
|
|
||||||
//- check if index is inside the scope (used for debugging only)
|
//- check if index is inside the scope (used for debugging only)
|
||||||
inline void checkIndex(const label) const;
|
inline void checkIndex(const label) const;
|
||||||
|
|
||||||
|
//- check if nAllocated_ is greater or equal to nextFree_
|
||||||
|
inline void checkAllocation() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
@ -100,6 +113,11 @@ public:
|
||||||
//- Construct given size
|
//- Construct given size
|
||||||
explicit inline DynList(const label);
|
explicit inline DynList(const label);
|
||||||
|
|
||||||
|
#if WM_LABEL_SIZE == 64
|
||||||
|
//- Construct given size
|
||||||
|
explicit inline DynList(const int);
|
||||||
|
#endif
|
||||||
|
|
||||||
//- Construct from given size and defualt value
|
//- Construct from given size and defualt value
|
||||||
explicit inline DynList(const label, const T&);
|
explicit inline DynList(const label, const T&);
|
||||||
|
|
||||||
|
@ -205,6 +223,10 @@ public:
|
||||||
template<class ListType>
|
template<class ListType>
|
||||||
inline void operator=(const ListType&);
|
inline void operator=(const ListType&);
|
||||||
|
|
||||||
|
//- Compare the list with the another one
|
||||||
|
inline bool operator==(const DynList<T, staticSize>&) const;
|
||||||
|
inline bool operator!=(const DynList<T, staticSize>&) const;
|
||||||
|
|
||||||
|
|
||||||
// IOstream operators
|
// IOstream operators
|
||||||
|
|
||||||
|
|
|
@ -23,48 +23,66 @@ License
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline T* Foam::DynList<T, staticSize>::data()
|
||||||
|
{
|
||||||
|
return dataPtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline const T* Foam::DynList<T, staticSize>::data() const
|
||||||
|
{
|
||||||
|
return dataPtr_;
|
||||||
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline void Foam::DynList<T, staticSize>::allocateSize(const label s)
|
inline void Foam::DynList<T, staticSize>::allocateSize(const label s)
|
||||||
{
|
{
|
||||||
if( s > UList<T>::size() )
|
checkAllocation();
|
||||||
|
|
||||||
|
if( s > staticSize )
|
||||||
{
|
{
|
||||||
T* newData = new T[s];
|
if( s > nAllocated_ )
|
||||||
|
{
|
||||||
|
//- allocates enough space for the elements
|
||||||
|
T* newData = new T[s];
|
||||||
|
|
||||||
for(label i=0;i<nextFree_;++i)
|
for(label i=0;i<nextFree_;++i)
|
||||||
newData[i] = this->operator[](i);
|
newData[i] = this->operator[](i);
|
||||||
|
|
||||||
T* data = UList<T>::begin();
|
if( nAllocated_ > staticSize )
|
||||||
if( data && (data != staticData_) )
|
delete [] dataPtr_;
|
||||||
delete [] data;
|
|
||||||
|
|
||||||
//UList<T>::reset(newData, s);
|
dataPtr_ = newData;
|
||||||
this->UList<T>::operator=(UList<T>(newData, s));
|
nAllocated_ = s;
|
||||||
|
}
|
||||||
|
else if( s < nAllocated_ )
|
||||||
|
{
|
||||||
|
//- shrinks the list
|
||||||
|
T* newData = new T[s];
|
||||||
|
|
||||||
|
for(label i=0;i<s;++i)
|
||||||
|
newData[i] = this->operator[](i);
|
||||||
|
|
||||||
|
delete [] dataPtr_;
|
||||||
|
|
||||||
|
dataPtr_ = newData;
|
||||||
|
nAllocated_ = s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( (s > staticSize) && (s < UList<T>::size()) )
|
else
|
||||||
{
|
{
|
||||||
T* newData = new T[s];
|
if( nAllocated_ > staticSize )
|
||||||
|
{
|
||||||
|
//- delete dynamically allocated data
|
||||||
|
for(label i=0;i<s;++i)
|
||||||
|
staticData_[i] = dataPtr_[i];
|
||||||
|
|
||||||
for(label i=0;i<s;++i)
|
delete [] dataPtr_;
|
||||||
newData[i] = this->operator[](i);
|
}
|
||||||
|
|
||||||
T* data = UList<T>::begin();
|
dataPtr_ = staticData_;
|
||||||
delete [] data;
|
nAllocated_ = staticSize;
|
||||||
|
|
||||||
//UList<T>::reset(newData, s);
|
|
||||||
this->UList<T>::operator=(UList<T>(newData, s));
|
|
||||||
}
|
|
||||||
else if( (s <= staticSize) && (UList<T>::size() > staticSize) )
|
|
||||||
{
|
|
||||||
for(label i=0;i<s;++i)
|
|
||||||
staticData_[i] = UList<T>::operator[](i);
|
|
||||||
|
|
||||||
T* data = UList<T>::begin();
|
|
||||||
if( data && (data != staticData_) )
|
|
||||||
delete [] data;
|
|
||||||
|
|
||||||
//UList<T>::reset(staticData_, staticSize);
|
|
||||||
this->UList<T>::operator=(UList<T>(staticData_, staticSize));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,60 +100,124 @@ inline void Foam::DynList<T, staticSize>::checkIndex(const label i) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline void Foam::DynList<T, staticSize>::checkAllocation() const
|
||||||
|
{
|
||||||
|
if( nextFree_ > nAllocated_ )
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"template<class T, Foam::label staticSize> "
|
||||||
|
"inline void Foam::DynList<T, staticSize>::"
|
||||||
|
"checkAllocation() const"
|
||||||
|
) << "nextFree_ is out of scope 0 " << " and " << nAllocated_
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline Foam::DynList<T, staticSize>::DynList()
|
inline Foam::DynList<T, staticSize>::DynList()
|
||||||
:
|
:
|
||||||
UList<T>(staticData_, staticSize),
|
dataPtr_(nullptr),
|
||||||
|
nAllocated_(0),
|
||||||
|
staticData_(),
|
||||||
nextFree_(0)
|
nextFree_(0)
|
||||||
{}
|
{
|
||||||
|
setSize(0);
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline Foam::DynList<T, staticSize>::DynList(const label s)
|
inline Foam::DynList<T, staticSize>::DynList(const label s)
|
||||||
:
|
:
|
||||||
UList<T>(staticData_, staticSize),
|
dataPtr_(nullptr),
|
||||||
|
nAllocated_(0),
|
||||||
|
staticData_(),
|
||||||
nextFree_(0)
|
nextFree_(0)
|
||||||
{
|
{
|
||||||
setSize(s);
|
setSize(s);
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if WM_LABEL_SIZE == 64
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline Foam::DynList<T, staticSize>::DynList(const int s)
|
||||||
|
:
|
||||||
|
dataPtr_(nullptr),
|
||||||
|
nAllocated_(0),
|
||||||
|
staticData_(),
|
||||||
|
nextFree_(0)
|
||||||
|
{
|
||||||
|
setSize(s);
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline Foam::DynList<T, staticSize>::DynList(const label s, const T& val)
|
inline Foam::DynList<T, staticSize>::DynList(const label s, const T& val)
|
||||||
:
|
:
|
||||||
UList<T>(staticData_, staticSize),
|
dataPtr_(nullptr),
|
||||||
|
nAllocated_(0),
|
||||||
|
staticData_(),
|
||||||
nextFree_(0)
|
nextFree_(0)
|
||||||
{
|
{
|
||||||
setSize(s);
|
setSize(s);
|
||||||
|
|
||||||
for(label i=0;i<s;++i)
|
for(label i=0;i<s;++i)
|
||||||
this->operator[](i) = val;
|
this->operator[](i) = val;
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline Foam::DynList<T, staticSize>::DynList(const UList<T>& ul)
|
inline Foam::DynList<T, staticSize>::DynList(const UList<T>& ul)
|
||||||
:
|
:
|
||||||
UList<T>(staticData_, staticSize),
|
dataPtr_(nullptr),
|
||||||
|
nAllocated_(0),
|
||||||
|
staticData_(),
|
||||||
nextFree_(0)
|
nextFree_(0)
|
||||||
{
|
{
|
||||||
setSize(ul.size());
|
setSize(ul.size());
|
||||||
|
|
||||||
forAll(ul, i)
|
forAll(ul, i)
|
||||||
this->operator[](i) = ul[i];
|
this->operator[](i) = ul[i];
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
template<class ListType>
|
template<class ListType>
|
||||||
inline Foam::DynList<T, staticSize>::DynList(const ListType& l)
|
inline Foam::DynList<T, staticSize>::DynList(const ListType& l)
|
||||||
:
|
:
|
||||||
UList<T>(staticData_, staticSize),
|
dataPtr_(nullptr),
|
||||||
|
nAllocated_(0),
|
||||||
|
staticData_(),
|
||||||
nextFree_(0)
|
nextFree_(0)
|
||||||
{
|
{
|
||||||
setSize(l.size());
|
setSize(l.size());
|
||||||
for(label i=0;i<nextFree_;++i)
|
for(label i=0;i<nextFree_;++i)
|
||||||
this->operator[](i) = l[i];
|
this->operator[](i) = l[i];
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Copy construct
|
//- Copy construct
|
||||||
|
@ -145,19 +227,24 @@ inline Foam::DynList<T, staticSize>::DynList
|
||||||
const DynList<T, staticSize>& dl
|
const DynList<T, staticSize>& dl
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
UList<T>(staticData_, staticSize),
|
dataPtr_(nullptr),
|
||||||
|
nAllocated_(0),
|
||||||
|
staticData_(),
|
||||||
nextFree_(0)
|
nextFree_(0)
|
||||||
{
|
{
|
||||||
setSize(dl.size());
|
setSize(dl.size());
|
||||||
for(label i=0;i<nextFree_;++i)
|
for(label i=0;i<nextFree_;++i)
|
||||||
this->operator[](i) = dl[i];
|
this->operator[](i) = dl[i];
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline Foam::DynList<T, staticSize>::~DynList()
|
inline Foam::DynList<T, staticSize>::~DynList()
|
||||||
{
|
{
|
||||||
allocateSize(0);
|
allocateSize(0);
|
||||||
//UList<T>::reset(nullptr, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,12 +253,20 @@ inline Foam::DynList<T, staticSize>::~DynList()
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline Foam::label Foam::DynList<T, staticSize>::size() const
|
inline Foam::label Foam::DynList<T, staticSize>::size() const
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
return nextFree_;
|
return nextFree_;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline Foam::label Foam::DynList<T, staticSize>::byteSize() const
|
inline Foam::label Foam::DynList<T, staticSize>::byteSize() const
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
if( !contiguous<T>() )
|
if( !contiguous<T>() )
|
||||||
{
|
{
|
||||||
FatalErrorIn("DynList<T>::byteSize()")
|
FatalErrorIn("DynList<T>::byteSize()")
|
||||||
|
@ -181,20 +276,31 @@ inline Foam::label Foam::DynList<T, staticSize>::byteSize() const
|
||||||
}
|
}
|
||||||
|
|
||||||
return nextFree_*sizeof(T);
|
return nextFree_*sizeof(T);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline void Foam::DynList<T, staticSize>::setSize(const label s)
|
inline void Foam::DynList<T, staticSize>::setSize(const label s)
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
allocateSize(s);
|
allocateSize(s);
|
||||||
nextFree_ = s;
|
nextFree_ = s;
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline void Foam::DynList<T, staticSize>::clear()
|
inline void Foam::DynList<T, staticSize>::clear()
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
nextFree_ = 0;
|
nextFree_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,34 +308,62 @@ inline void Foam::DynList<T, staticSize>::clear()
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
void Foam::DynList<T, staticSize>::shrink()
|
void Foam::DynList<T, staticSize>::shrink()
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
allocateSize(nextFree_);
|
allocateSize(nextFree_);
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline void Foam::DynList<T, staticSize>::append(const T& e)
|
inline void Foam::DynList<T, staticSize>::append(const T& e)
|
||||||
{
|
{
|
||||||
if( nextFree_ >= UList<T>::size() )
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
|
if( nextFree_ >= nAllocated_ )
|
||||||
{
|
{
|
||||||
const label newSize = 2*UList<T>::size()+2;
|
const label newSize = 2*nAllocated_+2;
|
||||||
allocateSize(newSize);
|
allocateSize(newSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
UList<T>::operator[](nextFree_++) = e;
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
|
this->operator[](nextFree_++) = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline void Foam::DynList<T, staticSize>::appendIfNotIn(const T& e)
|
inline void Foam::DynList<T, staticSize>::appendIfNotIn(const T& e)
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
if( !contains(e) )
|
if( !contains(e) )
|
||||||
append(e);
|
append(e);
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline bool Foam::DynList<T, staticSize>::contains(const T& e) const
|
inline bool Foam::DynList<T, staticSize>::contains(const T& e) const
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
for(label i=0;i<nextFree_;++i)
|
for(label i=0;i<nextFree_;++i)
|
||||||
{
|
{
|
||||||
if( UList<T>::operator[](i) == e )
|
if( this->operator[](i) == e )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,9 +376,13 @@ inline Foam::label Foam::DynList<T, staticSize>::containsAtPosition
|
||||||
const T& e
|
const T& e
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
for(label i=0;i<nextFree_;++i)
|
for(label i=0;i<nextFree_;++i)
|
||||||
{
|
{
|
||||||
if( UList<T>::operator[](i) == e )
|
if( this->operator[](i) == e )
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,12 +392,20 @@ inline Foam::label Foam::DynList<T, staticSize>::containsAtPosition
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline const T& Foam::DynList<T, staticSize>::lastElement() const
|
inline const T& Foam::DynList<T, staticSize>::lastElement() const
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
return this->operator[](nextFree_-1);
|
return this->operator[](nextFree_-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline T Foam::DynList<T, staticSize>::removeLastElement()
|
inline T Foam::DynList<T, staticSize>::removeLastElement()
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
if( nextFree_ == 0 )
|
if( nextFree_ == 0 )
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
|
@ -268,13 +414,18 @@ inline T Foam::DynList<T, staticSize>::removeLastElement()
|
||||||
) << "List is empty" << abort(FatalError);
|
) << "List is empty" << abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
T el = UList<T>::operator[](--nextFree_);
|
T el = this->operator[](nextFree_-1);
|
||||||
|
--nextFree_;
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline T Foam::DynList<T, staticSize>::removeElement(const label i)
|
inline T Foam::DynList<T, staticSize>::removeElement(const label i)
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
if( nextFree_ == 0 )
|
if( nextFree_ == 0 )
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
|
@ -287,12 +438,20 @@ inline T Foam::DynList<T, staticSize>::removeElement(const label i)
|
||||||
this->operator[](i) = this->operator[](nextFree_-1);
|
this->operator[](i) = this->operator[](nextFree_-1);
|
||||||
--nextFree_;
|
--nextFree_;
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline T& Foam::DynList<T, staticSize>::newElmt(const label i)
|
inline T& Foam::DynList<T, staticSize>::newElmt(const label i)
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
return this->operator()(i);
|
return this->operator()(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,13 +460,21 @@ inline T& Foam::DynList<T, staticSize>::newElmt(const label i)
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline T& Foam::DynList<T, staticSize>::operator()(const label i)
|
inline T& Foam::DynList<T, staticSize>::operator()(const label i)
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
nextFree_ = Foam::max(nextFree_, i + 1);
|
nextFree_ = Foam::max(nextFree_, i + 1);
|
||||||
|
|
||||||
if( nextFree_ >= UList<T>::size() )
|
if( nextFree_ >= nAllocated_ )
|
||||||
{
|
{
|
||||||
allocateSize(2 * nextFree_+1);
|
allocateSize(2 * nextFree_+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
return this->operator[](i);
|
return this->operator[](i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,20 +482,22 @@ template<class T, Foam::label staticSize>
|
||||||
inline const T& Foam::DynList<T, staticSize>::operator[](const label i) const
|
inline const T& Foam::DynList<T, staticSize>::operator[](const label i) const
|
||||||
{
|
{
|
||||||
# ifdef FULLDEBUG
|
# ifdef FULLDEBUG
|
||||||
|
checkAllocation();
|
||||||
checkIndex(i);
|
checkIndex(i);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
return UList<T>::operator[](i);
|
return dataPtr_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline T& Foam::DynList<T, staticSize>::operator[](const label i)
|
inline T& Foam::DynList<T, staticSize>::operator[](const label i)
|
||||||
{
|
{
|
||||||
# ifdef FULLDEBUG
|
# ifdef FULLDEBUG
|
||||||
|
checkAllocation();
|
||||||
checkIndex(i);
|
checkIndex(i);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
return UList<T>::operator[](i);
|
return dataPtr_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
|
@ -374,7 +543,12 @@ inline const T& Foam::DynList<T, staticSize>::rcElement
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
inline void Foam::DynList<T, staticSize>::operator=(const T& t)
|
inline void Foam::DynList<T, staticSize>::operator=(const T& t)
|
||||||
{
|
{
|
||||||
UList<T>::operator=(t);
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
|
for(label i=0;i<nextFree_;++i)
|
||||||
|
operator[](i) = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label staticSize>
|
template<class T, Foam::label staticSize>
|
||||||
|
@ -383,9 +557,17 @@ inline void Foam::DynList<T, staticSize>::operator=
|
||||||
const DynList<T, staticSize>& dl
|
const DynList<T, staticSize>& dl
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
allocateSize(dl.size());
|
allocateSize(dl.size());
|
||||||
nextFree_ = dl.size();
|
nextFree_ = dl.size();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
for(label i=0;i<nextFree_;++i)
|
for(label i=0;i<nextFree_;++i)
|
||||||
this->operator[](i) = dl[i];
|
this->operator[](i) = dl[i];
|
||||||
}
|
}
|
||||||
|
@ -394,12 +576,45 @@ template<class T, Foam::label staticSize>
|
||||||
template<class ListType>
|
template<class ListType>
|
||||||
inline void Foam::DynList<T, staticSize>::operator=(const ListType& l)
|
inline void Foam::DynList<T, staticSize>::operator=(const ListType& l)
|
||||||
{
|
{
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
allocateSize(l.size());
|
allocateSize(l.size());
|
||||||
nextFree_ = l.size();
|
nextFree_ = l.size();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
checkAllocation();
|
||||||
|
# endif
|
||||||
|
|
||||||
for(label i=0;i<nextFree_;++i)
|
for(label i=0;i<nextFree_;++i)
|
||||||
this->operator[](i) = l[i];
|
this->operator[](i) = l[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline bool Foam::DynList<T, staticSize>::operator==
|
||||||
|
(
|
||||||
|
const DynList<T, staticSize>& DL
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if( nextFree_ != DL.nextFree_ )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
forAll(DL, i)
|
||||||
|
if( this->operator[](i) != DL[i] )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline bool Foam::DynList<T, staticSize>::operator!=
|
||||||
|
(
|
||||||
|
const DynList<T, staticSize>& DL
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return !operator==(DL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
|
@ -34,15 +34,34 @@ Foam::Ostream& Foam::operator<<
|
||||||
const Foam::FRWGraph<T, width>& DL
|
const Foam::FRWGraph<T, width>& DL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os << DL.size() << "(" << endl;
|
os << DL.size() << "(" << nl;
|
||||||
for(register label i=0;i<DL.size();++i)
|
|
||||||
|
for(label i=0;i<DL.size();++i)
|
||||||
{
|
{
|
||||||
os << width << "(";
|
os << width << "(";
|
||||||
|
|
||||||
for(label j=0;j<width;++j)
|
for(label j=0;j<width;++j)
|
||||||
os << DL(i, j) << " " << endl;
|
{
|
||||||
os << ")" << endl;
|
if( j )
|
||||||
|
{
|
||||||
|
os << " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
os << DL(i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
os << ")" << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
os << ")";
|
os << ")";
|
||||||
|
|
||||||
|
// Check state of IOstream
|
||||||
|
os.check
|
||||||
|
(
|
||||||
|
"template<class T, Foam::label width>Foam::Ostream& Foam::operator<<"
|
||||||
|
"(Foam::Ostream& os, const Foam::FRWGraph<T, width>&)"
|
||||||
|
);
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ inline Foam::label Foam::FRWGraph<T,width>::size() const
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, Foam::label width>
|
template<class T, Foam::label width>
|
||||||
inline Foam::label Foam::FRWGraph<T,width>::sizeOfRow(const label rowI) const
|
inline Foam::label Foam::FRWGraph<T,width>::sizeOfRow(const label) const
|
||||||
{
|
{
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,8 @@ inline bool Foam::FRWGraph<T,width>::contains
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const label start = rowI * width;
|
const label start = rowI * width;
|
||||||
for(register label i=0;i<width;++i)
|
|
||||||
|
for(label i=0;i<width;++i)
|
||||||
if( data_[start+i] == e )
|
if( data_[start+i] == e )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -170,7 +171,8 @@ inline Foam::label Foam::FRWGraph<T,width>::containsAtPosition
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const label start = rowI * width;
|
const label start = rowI * width;
|
||||||
for(register label i=0;i<width;++i)
|
|
||||||
|
for(label i=0;i<width;++i)
|
||||||
if( data_[start+i] == e )
|
if( data_[start+i] == e )
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ IODynList<T, IndexType>::IODynList(const IOobject& io)
|
||||||
(
|
(
|
||||||
io.readOpt() == IOobject::MUST_READ
|
io.readOpt() == IOobject::MUST_READ
|
||||||
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||||
|| (io.readOpt() == IOobject::READ_IF_PRESENT_IF_MODIFIED && headerOk())
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
readStream(typeName) >> *this;
|
readStream(typeName) >> *this;
|
||||||
|
@ -77,16 +76,12 @@ IODynList<T, IndexType>::IODynList
|
||||||
regIOobject(io),
|
regIOobject(io),
|
||||||
DynList<T, IndexType>()
|
DynList<T, IndexType>()
|
||||||
{
|
{
|
||||||
if
|
if (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||||
(
|
|
||||||
(io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
|
||||||
|| (io.readOpt() == IOobject::READ_IF_PRESENT_IF_MODIFIED && headerOk())
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
readStream(typeName) >> *this;
|
readStream(typeName) >> *this;
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
DynList<T, IndexType>::operator=(list);
|
DynList<T, IndexType>::operator=(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ IOLongList<T, Offset>::IOLongList(const IOobject& io)
|
||||||
(
|
(
|
||||||
io.readOpt() == IOobject::MUST_READ
|
io.readOpt() == IOobject::MUST_READ
|
||||||
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||||
|| (io.readOpt() == IOobject::READ_IF_PRESENT_IF_MODIFIED && headerOk())
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
readStream(typeName) >> *this;
|
readStream(typeName) >> *this;
|
||||||
|
@ -77,16 +76,12 @@ IOLongList<T, Offset>::IOLongList
|
||||||
regIOobject(io),
|
regIOobject(io),
|
||||||
LongList<T, Offset>()
|
LongList<T, Offset>()
|
||||||
{
|
{
|
||||||
if
|
if (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||||
(
|
|
||||||
(io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
|
||||||
|| (io.readOpt() == IOobject::READ_IF_PRESENT_IF_MODIFIED && headerOk())
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
readStream(typeName) >> *this;
|
readStream(typeName) >> *this;
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
LongList<T, Offset>::operator=(list);
|
LongList<T, Offset>::operator=(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ Foam::Istream& Foam::operator>>
|
||||||
|
|
||||||
if( listDelimiter == token::BEGIN_LIST )
|
if( listDelimiter == token::BEGIN_LIST )
|
||||||
{
|
{
|
||||||
for(register label i=0;i<size;++i)
|
for(label i=0;i<size;++i)
|
||||||
{
|
{
|
||||||
is >> DL[i];
|
is >> DL[i];
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ Foam::Istream& Foam::operator>>
|
||||||
"reading the single entry"
|
"reading the single entry"
|
||||||
);
|
);
|
||||||
|
|
||||||
for(register label i=0;i<size;++i)
|
for(label i=0;i<size;++i)
|
||||||
{
|
{
|
||||||
DL[i] = element;
|
DL[i] = element;
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ void Foam::LongList<T, Offset>::appendFromStream(Istream& is)
|
||||||
|
|
||||||
if( listDelimiter == token::BEGIN_LIST )
|
if( listDelimiter == token::BEGIN_LIST )
|
||||||
{
|
{
|
||||||
for(register label i=0;i<size;++i)
|
for(label i=0;i<size;++i)
|
||||||
{
|
{
|
||||||
is >> this->operator[](origSize);
|
is >> this->operator[](origSize);
|
||||||
++origSize;
|
++origSize;
|
||||||
|
@ -328,7 +328,7 @@ void Foam::LongList<T, Offset>::appendFromStream(Istream& is)
|
||||||
"reading the single entry"
|
"reading the single entry"
|
||||||
);
|
);
|
||||||
|
|
||||||
for(register label i=0;i<size;++i)
|
for(label i=0;i<size;++i)
|
||||||
{
|
{
|
||||||
this->operator[](origSize) = element;
|
this->operator[](origSize) = element;
|
||||||
++origSize;
|
++origSize;
|
||||||
|
@ -346,31 +346,6 @@ void Foam::LongList<T, Offset>::appendFromStream(Istream& is)
|
||||||
forAll(buf, i)
|
forAll(buf, i)
|
||||||
this->operator[](origSize++) = buf[i];
|
this->operator[](origSize++) = buf[i];
|
||||||
|
|
||||||
/*const label blockSize = 1<<shift_;
|
|
||||||
|
|
||||||
Info << "nextFree_ " << nextFree_ << endl;
|
|
||||||
|
|
||||||
//- append elements by reading binary block
|
|
||||||
while( origSize < nextFree_ )
|
|
||||||
{
|
|
||||||
const label currBlock = origSize >> shift_;
|
|
||||||
const label currPos = origSize & mask_;
|
|
||||||
|
|
||||||
Info << "Orig size " << origSize
|
|
||||||
<< nl << "currBlock " << currBlock
|
|
||||||
<< nl << "currPos " << currPos << endl;
|
|
||||||
|
|
||||||
T* data = &dataPtr_[currBlock][currPos];
|
|
||||||
|
|
||||||
label bs = Foam::min(nextFree_-origSize, blockSize);
|
|
||||||
bs = Foam::min(blockSize - currPos, bs);
|
|
||||||
|
|
||||||
Info << "bs " << bs << endl;
|
|
||||||
|
|
||||||
is.read(reinterpret_cast<char*>(data), bs * sizeof(T));
|
|
||||||
origSize += bs;
|
|
||||||
} */
|
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
"appendFromStream(Istream& is)"
|
"appendFromStream(Istream& is)"
|
||||||
|
|
|
@ -78,7 +78,7 @@ inline void Foam::LongList<T, Offset>::allocateSize(const label s)
|
||||||
|
|
||||||
if( numblock1 < numBlocks_ )
|
if( numblock1 < numBlocks_ )
|
||||||
{
|
{
|
||||||
for(register label i=numblock1;i<numBlocks_;++i)
|
for(label i=numblock1;i<numBlocks_;++i)
|
||||||
delete [] dataPtr_[i];
|
delete [] dataPtr_[i];
|
||||||
}
|
}
|
||||||
else if( numblock1 > numBlocks_ )
|
else if( numblock1 > numBlocks_ )
|
||||||
|
@ -91,7 +91,8 @@ inline void Foam::LongList<T, Offset>::allocateSize(const label s)
|
||||||
} 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(label i=0;i<numBlocks_;++i)
|
||||||
dataptr1[i] = dataPtr_[i];
|
dataptr1[i] = dataPtr_[i];
|
||||||
|
|
||||||
if( dataPtr_ )
|
if( dataPtr_ )
|
||||||
|
@ -99,7 +100,7 @@ inline void Foam::LongList<T, Offset>::allocateSize(const label s)
|
||||||
dataPtr_ = dataptr1;
|
dataPtr_ = dataptr1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(register label i=numBlocks_;i<numblock1;++i)
|
for(label i=numBlocks_;i<numblock1;++i)
|
||||||
dataPtr_[i] = new T[blockSize];
|
dataPtr_[i] = new T[blockSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ inline void Foam::LongList<T, Offset>::allocateSize(const label s)
|
||||||
template<class T, Foam::label Offset>
|
template<class T, Foam::label Offset>
|
||||||
void Foam::LongList<T, Offset>::clearOut()
|
void Foam::LongList<T, Offset>::clearOut()
|
||||||
{
|
{
|
||||||
for(register label i=0;i<numBlocks_;++i)
|
for(label i=0;i<numBlocks_;++i)
|
||||||
delete [] dataPtr_[i];
|
delete [] dataPtr_[i];
|
||||||
|
|
||||||
if( dataPtr_ )
|
if( dataPtr_ )
|
||||||
|
@ -281,7 +282,7 @@ inline void Foam::LongList<T, Offset>::appendIfNotIn(const T& e)
|
||||||
template<class T, Foam::label Offset>
|
template<class T, Foam::label Offset>
|
||||||
inline bool Foam::LongList<T, Offset>::contains(const T& e) const
|
inline bool Foam::LongList<T, Offset>::contains(const T& e) const
|
||||||
{
|
{
|
||||||
for(register label i=0;i<nextFree_;++i)
|
for(label i=0;i<nextFree_;++i)
|
||||||
if( (*this)[i] == e )
|
if( (*this)[i] == e )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -294,7 +295,7 @@ inline Foam::label Foam::LongList<T, Offset>::containsAtPosition
|
||||||
const T& e
|
const T& e
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
for(register label i=0;i<nextFree_;++i)
|
for(label i=0;i<nextFree_;++i)
|
||||||
if( (*this)[i] == e )
|
if( (*this)[i] == e )
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
|
@ -376,7 +377,7 @@ inline T& Foam::LongList<T, Offset>::newElmt(const label i)
|
||||||
template<class T, Foam::label Offset>
|
template<class T, Foam::label Offset>
|
||||||
inline void Foam::LongList<T, Offset>::operator=(const T& t)
|
inline void Foam::LongList<T, Offset>::operator=(const T& t)
|
||||||
{
|
{
|
||||||
for(register label i=0;i<nextFree_;++i)
|
for(label i=0;i<nextFree_;++i)
|
||||||
operator[](i) = t;
|
operator[](i) = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +385,8 @@ template<class T, Foam::label Offset>
|
||||||
inline void Foam::LongList<T, Offset>::operator=(const LongList<T, Offset>& l)
|
inline void Foam::LongList<T, Offset>::operator=(const LongList<T, Offset>& l)
|
||||||
{
|
{
|
||||||
setSize(l.size());
|
setSize(l.size());
|
||||||
for(register label i=0;i<l.nextFree_;++i)
|
|
||||||
|
for(label i=0;i<l.nextFree_;++i)
|
||||||
operator[](i) = l[i];
|
operator[](i) = l[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,22 +35,29 @@ Foam::Ostream& Foam::operator<<
|
||||||
const Foam::VRWGraph& DL
|
const Foam::VRWGraph& DL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os << DL.size() << nl << token::BEGIN_LIST;
|
os << DL.size() << nl << token::BEGIN_LIST << nl;
|
||||||
|
|
||||||
for(register label i=0;i<DL.size();++i)
|
for(label i=0;i<DL.size();++i)
|
||||||
{
|
{
|
||||||
os << nl << DL.sizeOfRow(i) << token::BEGIN_LIST;
|
os << 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 ) os << token::SPACE;
|
||||||
|
|
||||||
os << DL(i, j);
|
os << DL(i, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
os << token::END_LIST;
|
os << token::END_LIST << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
os << nl << token::END_LIST;
|
os << token::END_LIST;
|
||||||
|
|
||||||
|
// Check state of IOstream
|
||||||
|
os.check
|
||||||
|
(
|
||||||
|
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, const Foam::VRWGraph&)"
|
||||||
|
);
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ SourceFiles
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
class VRWGraphModifier;
|
class VRWGraphModifier;
|
||||||
|
|
||||||
class rowElement
|
class rowElement
|
||||||
|
@ -95,6 +96,12 @@ class rowElement
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Forward declaration of friend functions and operators
|
||||||
|
|
||||||
|
class VRWGraph;
|
||||||
|
|
||||||
|
Ostream& operator<<(Ostream&, const VRWGraph&);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class VRWGraph Declaration
|
Class VRWGraph Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -518,7 +518,7 @@ inline bool Foam::VRWGraph::contains
|
||||||
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(label i=0;i<size;++i)
|
||||||
if( data_[start+i] == e )
|
if( data_[start+i] == e )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -536,7 +536,8 @@ inline Foam::label Foam::VRWGraph::containsAtPosition
|
||||||
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(label i=0;i<size;++i)
|
||||||
if( data_[start+i] == e )
|
if( data_[start+i] == e )
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -37,12 +37,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(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;
|
||||||
|
|
||||||
|
// Check state of IOstream
|
||||||
|
os.check
|
||||||
|
(
|
||||||
|
"Foam::Ostream& Foam::operator<<"
|
||||||
|
"(Foam::Ostream&, const Foam::VRWGraphList&)"
|
||||||
|
);
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,17 +45,23 @@ SourceFiles
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward declaration of friend functions and operators
|
||||||
|
|
||||||
|
class VRWGraphList;
|
||||||
|
|
||||||
|
Ostream& operator<<(Ostream&, const VRWGraphList&);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class VRWGraphList Declaration
|
Class VRWGraphList Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
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 +73,7 @@ class VRWGraphList
|
||||||
const label j,
|
const label j,
|
||||||
const label k
|
const label k
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
@ -88,10 +94,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 +109,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 +117,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&);
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -26,8 +26,6 @@ Description
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "foamTime.H"
|
|
||||||
#include "polyMeshGen.H"
|
#include "polyMeshGen.H"
|
||||||
#include "meshSurfaceEngine.H"
|
#include "meshSurfaceEngine.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -117,7 +117,7 @@ void decomposeCells::checkFaceConnections(const boolList& decomposeCell)
|
||||||
|
|
||||||
OPstream toOtherProc
|
OPstream toOtherProc
|
||||||
(
|
(
|
||||||
Pstream::blocking,
|
Pstream::commsTypes::blocking,
|
||||||
procBoundaries[patchI].neiProcNo(),
|
procBoundaries[patchI].neiProcNo(),
|
||||||
decFace.byteSize()
|
decFace.byteSize()
|
||||||
);
|
);
|
||||||
|
@ -132,7 +132,7 @@ void decomposeCells::checkFaceConnections(const boolList& decomposeCell)
|
||||||
|
|
||||||
IPstream fromOtherProc
|
IPstream fromOtherProc
|
||||||
(
|
(
|
||||||
Pstream::blocking,
|
Pstream::commsTypes::blocking,
|
||||||
procBoundaries[patchI].neiProcNo()
|
procBoundaries[patchI].neiProcNo()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ void decomposeCells::createPointsAndCellFaces(const boolList& decomposeCell)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void decomposeCells::storeBoundaryFaces(const boolList& decomposeCell)
|
void decomposeCells::storeBoundaryFaces(const boolList& /*decomposeCell*/)
|
||||||
{
|
{
|
||||||
meshSurfaceEngine mse(mesh_);
|
meshSurfaceEngine mse(mesh_);
|
||||||
const faceList::subList& bFaces = mse.boundaryFaces();
|
const faceList::subList& bFaces = mse.boundaryFaces();
|
||||||
|
|
|
@ -23,7 +23,7 @@ License
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
\*----------------------p-----------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "decomposeCells.H"
|
#include "decomposeCells.H"
|
||||||
#include "helperFunctions.H"
|
#include "helperFunctions.H"
|
||||||
|
@ -55,8 +55,10 @@ void decomposeCells::findAddressingForCell
|
||||||
const faceListPMG& faces = mesh_.faces();
|
const faceListPMG& faces = mesh_.faces();
|
||||||
forAll(faceEdges, feI)
|
forAll(faceEdges, feI)
|
||||||
{
|
{
|
||||||
faceEdges[feI].setSize(faces[c[feI]].size());
|
DynList<label, 8>& fEdges = faceEdges[feI];
|
||||||
faceEdges[feI] = -1;
|
|
||||||
|
fEdges.setSize(faces[c[feI]].size());
|
||||||
|
fEdges = label(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(c, fI)
|
forAll(c, fI)
|
||||||
|
@ -127,9 +129,9 @@ void decomposeCells::findAddressingForCell
|
||||||
label decomposeCells::findTopVertex
|
label decomposeCells::findTopVertex
|
||||||
(
|
(
|
||||||
const label cellI,
|
const label cellI,
|
||||||
const DynList<label, 32>& vrt,
|
const DynList<label, 32>& /*vrt*/,
|
||||||
const DynList<edge, 64>& edges,
|
const DynList<edge, 64>& /*edges*/,
|
||||||
const DynList<DynList<label, 2>, 64>& edgeFaces
|
const DynList<DynList<label, 2>, 64>& /*edgeFaces*/
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const cell& c = mesh_.cells()[cellI];
|
const cell& c = mesh_.cells()[cellI];
|
||||||
|
|
|
@ -370,7 +370,7 @@ void decomposeFaces::decomposeConcaveInternalFaces
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
//- decompose internal faces
|
//- decompose internal faces
|
||||||
for(register label faceI=0;faceI<nIntFaces;++faceI)
|
for(label faceI=0;faceI<nIntFaces;++faceI)
|
||||||
{
|
{
|
||||||
const face& f = faces[faceI];
|
const face& f = faces[faceI];
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -26,6 +26,7 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "quadricFitting.H"
|
#include "quadricFitting.H"
|
||||||
|
#include "helperFunctions.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -48,11 +49,15 @@ void quadricFitting::calculateNormalVector()
|
||||||
mat /= otherPoints_.size();
|
mat /= otherPoints_.size();
|
||||||
|
|
||||||
//- find the eigenvalues of the tensor
|
//- find the eigenvalues of the tensor
|
||||||
const vector ev = eigenValues(mat);
|
const vector ev = help::eigenValues(mat);
|
||||||
|
|
||||||
//- estimate the normal as the eigenvector associated
|
//- estimate the normal as the eigenvector associated
|
||||||
//- to the smallest eigenvalue
|
//- to the smallest eigenvalue
|
||||||
normal_ = eigenVector(mat, ev[0]);
|
# ifdef OpenCFDSpecific
|
||||||
|
normal_ = eigenVectors(mat, ev).x();
|
||||||
|
# else
|
||||||
|
normal_ = help::eigenVector(mat, ev[0]);
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void quadricFitting::calculateCoordinateSystem()
|
void quadricFitting::calculateCoordinateSystem()
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -99,12 +99,10 @@ class parTriFace
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
inline bool operator !=(const parTriFace& ptf) const
|
inline bool operator !=(const parTriFace& /*ptf*/) const
|
||||||
{
|
{
|
||||||
Serr << "parTriFace::operator!= Not implemented" << endl;
|
Serr << "parTriFace::operator!= Not implemented" << endl;
|
||||||
::exit(1);
|
::exit(1);
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Friend operators
|
// Friend operators
|
||||||
|
|
|
@ -50,7 +50,7 @@ void sortEdgesIntoChains::createNodeLabels()
|
||||||
newNodeLabel_.insert(e.end(), nPoints++);
|
newNodeLabel_.insert(e.end(), nPoints++);
|
||||||
}
|
}
|
||||||
|
|
||||||
edgesAtPoint_.setSize(nPoints, DynList<label>());
|
edgesAtPoint_.setSize(nPoints);
|
||||||
forAll(bEdges_, eI)
|
forAll(bEdges_, eI)
|
||||||
{
|
{
|
||||||
const edge& e = bEdges_[eI];
|
const edge& e = bEdges_[eI];
|
||||||
|
@ -69,7 +69,7 @@ void sortEdgesIntoChains::createNodeLabels()
|
||||||
bool sortEdgesIntoChains::findPointsBelongingToTheChain
|
bool sortEdgesIntoChains::findPointsBelongingToTheChain
|
||||||
(
|
(
|
||||||
const label currPos,
|
const label currPos,
|
||||||
boolList& chainEdges
|
DynList<bool>& chainEdges
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
# ifdef DEBUGSort
|
# ifdef DEBUGSort
|
||||||
|
@ -150,7 +150,7 @@ bool sortEdgesIntoChains::findPointsBelongingToTheChain
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sortEdgesIntoChains::shrinkEdges(const boolList& chainEdges)
|
void sortEdgesIntoChains::shrinkEdges(const DynList<bool>& chainEdges)
|
||||||
{
|
{
|
||||||
forAll(chainEdges, eI)
|
forAll(chainEdges, eI)
|
||||||
if( chainEdges[eI] )
|
if( chainEdges[eI] )
|
||||||
|
@ -168,14 +168,14 @@ void sortEdgesIntoChains::shrinkEdges(const boolList& chainEdges)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sortEdgesIntoChains::createChainFromEdges(const boolList& chainEdges)
|
void sortEdgesIntoChains::createChainFromEdges(const DynList<bool>& chainEdges)
|
||||||
{
|
{
|
||||||
direction i(0);
|
label i(0);
|
||||||
forAll(chainEdges, eI)
|
forAll(chainEdges, eI)
|
||||||
if( chainEdges[eI] )
|
if( chainEdges[eI] )
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
labelList chainPoints(i);
|
DynList<label> chainPoints(i);
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
forAll(chainEdges, eI)
|
forAll(chainEdges, eI)
|
||||||
|
@ -232,7 +232,7 @@ void sortEdgesIntoChains::sortEdges()
|
||||||
|
|
||||||
if( !openEdges_ )
|
if( !openEdges_ )
|
||||||
{
|
{
|
||||||
boolList chainEdges(bEdges_.size());
|
DynList<bool> chainEdges(bEdges_.size());
|
||||||
forAll(edgesAtPoint_, pI)
|
forAll(edgesAtPoint_, pI)
|
||||||
if( findPointsBelongingToTheChain(pI, chainEdges) )
|
if( findPointsBelongingToTheChain(pI, chainEdges) )
|
||||||
{
|
{
|
||||||
|
@ -257,12 +257,11 @@ sortEdgesIntoChains::sortEdgesIntoChains(const DynList<edge>& bEdges)
|
||||||
}
|
}
|
||||||
|
|
||||||
sortEdgesIntoChains::~sortEdgesIntoChains()
|
sortEdgesIntoChains::~sortEdgesIntoChains()
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
|
||||||
// Member functions
|
// Member functions
|
||||||
const DynList<labelList>& sortEdgesIntoChains::sortedChains() const
|
const DynList<DynList<label> >& sortEdgesIntoChains::sortedChains() const
|
||||||
{
|
{
|
||||||
return createdChains_;
|
return createdChains_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ SourceFiles
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
#include "edge.H"
|
#include "edge.H"
|
||||||
#include "Map.H"
|
#include "Map.H"
|
||||||
#include "boolList.H"
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
@ -57,9 +56,9 @@ class sortEdgesIntoChains
|
||||||
|
|
||||||
Map<label> newNodeLabel_;
|
Map<label> newNodeLabel_;
|
||||||
|
|
||||||
List<DynList<label> > edgesAtPoint_;
|
DynList<DynList<label> > edgesAtPoint_;
|
||||||
|
|
||||||
DynList<labelList> createdChains_;
|
DynList<DynList<label> > createdChains_;
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
void createNodeLabels();
|
void createNodeLabels();
|
||||||
|
@ -67,12 +66,12 @@ class sortEdgesIntoChains
|
||||||
bool findPointsBelongingToTheChain
|
bool findPointsBelongingToTheChain
|
||||||
(
|
(
|
||||||
const label currPos,
|
const label currPos,
|
||||||
boolList& chainEdges
|
DynList<bool>& chainEdges
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void shrinkEdges(const boolList& chainEdges);
|
void shrinkEdges(const DynList<bool>& chainEdges);
|
||||||
|
|
||||||
void createChainFromEdges(const boolList& chainEdges);
|
void createChainFromEdges(const DynList<bool>& chainEdges);
|
||||||
|
|
||||||
void sortEdges();
|
void sortEdges();
|
||||||
|
|
||||||
|
@ -88,7 +87,7 @@ class 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<DynList<label> >& sortedChains() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
|
@ -316,7 +316,7 @@ label groupMarking
|
||||||
//- ones into a new group
|
//- ones into a new group
|
||||||
DynList<label> globalGroupLabel;
|
DynList<label> globalGroupLabel;
|
||||||
globalGroupLabel.setSize(nGroups);
|
globalGroupLabel.setSize(nGroups);
|
||||||
globalGroupLabel = -1;
|
globalGroupLabel = label(-1);
|
||||||
|
|
||||||
//- reduce the information about the groups
|
//- reduce the information about the groups
|
||||||
label counter(0);
|
label counter(0);
|
||||||
|
|
|
@ -65,6 +65,12 @@ namespace help
|
||||||
template<class ListType>
|
template<class ListType>
|
||||||
bool isinf(const ListType&);
|
bool isinf(const ListType&);
|
||||||
|
|
||||||
|
//- calculate eigenvalues
|
||||||
|
inline vector eigenValues(const tensor&);
|
||||||
|
|
||||||
|
//- calculate eigenvector associated with a given eigenvalue
|
||||||
|
inline vector eigenVector(const tensor&, const scalar eigenValue);
|
||||||
|
|
||||||
//- check if the faces share a convex edge
|
//- check if the faces share a convex edge
|
||||||
template<class Face1, class Face2>
|
template<class Face1, class Face2>
|
||||||
inline bool isSharedEdgeConvex
|
inline bool isSharedEdgeConvex
|
||||||
|
@ -289,6 +295,9 @@ namespace help
|
||||||
DynList<bool>& OkPoints
|
DynList<bool>& OkPoints
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- calculate quality metric of a tetrahedron
|
||||||
|
inline scalar tetQuality(const tetrahedron<point, point>& tet);
|
||||||
|
|
||||||
//- check if the vertex is on the positive side of the face plane
|
//- check if the vertex is on the positive side of the face plane
|
||||||
inline bool isVertexVisible(const point& p, const plane& pl);
|
inline bool isVertexVisible(const point& p, const plane& pl);
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,168 @@ bool isinf(const ListType& l)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline vector eigenValues(const tensor& t)
|
||||||
|
{
|
||||||
|
vector ret(vector::zero);
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(
|
||||||
|
mag(t.xy()) + mag(t.xz()) + mag(t.yx())
|
||||||
|
+ mag(t.yz()) + mag(t.zx()) + mag(t.zy())
|
||||||
|
)
|
||||||
|
< SMALL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// diagonal matrix
|
||||||
|
ret.x() = t.xx();
|
||||||
|
ret.y() = t.yy();
|
||||||
|
ret.z() = t.zz();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const scalar a = -t.xx() - t.yy() - t.zz();
|
||||||
|
|
||||||
|
const scalar b = t.xx()*t.yy() + t.xx()*t.zz() + t.yy()*t.zz()
|
||||||
|
- t.xy()*t.yx() - t.xz()*t.zx() - t.yz()*t.zy();
|
||||||
|
|
||||||
|
const scalar c = - t.xx()*t.yy()*t.zz() - t.xy()*t.yz()*t.zx()
|
||||||
|
- t.xz()*t.yx()*t.zy() + t.xz()*t.yy()*t.zx()
|
||||||
|
+ t.xy()*t.yx()*t.zz() + t.xx()*t.yz()*t.zy();
|
||||||
|
|
||||||
|
// If there is a zero root
|
||||||
|
if( mag(c) < ROOTVSMALL )
|
||||||
|
{
|
||||||
|
const scalar disc = max(sqr(a) - 4*b, 0.0);
|
||||||
|
|
||||||
|
const scalar q = -0.5 * sqrt(max(0.0, disc));
|
||||||
|
|
||||||
|
ret.x() = 0;
|
||||||
|
ret.y() = -0.5 * a + q;
|
||||||
|
ret.z() = -0.5 * a - q;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const scalar Q = (a*a - 3*b)/9.0;
|
||||||
|
const scalar R = (2.0*a*a*a - 9.0*a*b + 27.0*c)/54.0;
|
||||||
|
|
||||||
|
const scalar R2 = sqr(R);
|
||||||
|
const scalar Q3 = pow3(Q);
|
||||||
|
|
||||||
|
if( R2 < Q3 )
|
||||||
|
{
|
||||||
|
//- there exist three real roots
|
||||||
|
const scalar sqrtQ = sqrt(Q);
|
||||||
|
const scalar theta = acos(R / (Q*sqrtQ));
|
||||||
|
|
||||||
|
const scalar m2SqrtQ = -2.0 * sqrtQ;
|
||||||
|
const scalar aBy3 = a / 3.0;
|
||||||
|
|
||||||
|
ret.x() = m2SqrtQ*cos(theta/3) - aBy3;
|
||||||
|
ret.y() = m2SqrtQ*cos((theta + 2.0 * M_PI)/3.0) - aBy3;
|
||||||
|
ret.z() = m2SqrtQ*cos((theta - 2.0 * M_PI)/3.0) - aBy3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const scalar A = cbrt(R + sqrt(R2 - Q3));
|
||||||
|
|
||||||
|
//- three equal roots exist in this case
|
||||||
|
if( A < SMALL )
|
||||||
|
{
|
||||||
|
const scalar root = -a/3;
|
||||||
|
return vector(root, root, root);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//- roots are complex, return zero in this case
|
||||||
|
return vector::zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Sort the eigenvalues into ascending order
|
||||||
|
if( ret.x() > ret.y() )
|
||||||
|
{
|
||||||
|
Swap(ret.x(), ret.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ret.y() > ret.z() )
|
||||||
|
{
|
||||||
|
Swap(ret.y(), ret.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ret.x() > ret.y() )
|
||||||
|
{
|
||||||
|
Swap(ret.x(), ret.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline vector eigenVector(const tensor& t, const scalar eigenValue)
|
||||||
|
{
|
||||||
|
if( mag(eigenValue) < SMALL )
|
||||||
|
{
|
||||||
|
return vector::zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct the matrix for the eigenvector problem
|
||||||
|
const tensor A(t - eigenValue*I);
|
||||||
|
|
||||||
|
// Calculate the sub-determinants of the 3 components
|
||||||
|
scalar sd0 = A.yy()*A.zz() - A.yz()*A.zy();
|
||||||
|
scalar sd1 = A.xx()*A.zz() - A.xz()*A.zx();
|
||||||
|
scalar sd2 = A.xx()*A.yy() - A.xy()*A.yx();
|
||||||
|
|
||||||
|
scalar magSd0 = mag(sd0);
|
||||||
|
scalar magSd1 = mag(sd1);
|
||||||
|
scalar magSd2 = mag(sd2);
|
||||||
|
|
||||||
|
// Evaluate the eigenvector using the largest sub-determinant
|
||||||
|
if (magSd0 >= magSd1 && magSd0 >= magSd2 && magSd0 > SMALL)
|
||||||
|
{
|
||||||
|
vector ev
|
||||||
|
(
|
||||||
|
1,
|
||||||
|
(A.yz()*A.zx() - A.zz()*A.yx())/sd0,
|
||||||
|
(A.zy()*A.yx() - A.yy()*A.zx())/sd0
|
||||||
|
);
|
||||||
|
ev /= (mag(ev) + VSMALL);
|
||||||
|
|
||||||
|
return ev;
|
||||||
|
}
|
||||||
|
else if (magSd1 >= magSd2 && magSd1 > SMALL)
|
||||||
|
{
|
||||||
|
vector ev
|
||||||
|
(
|
||||||
|
(A.xz()*A.zy() - A.zz()*A.xy())/sd1,
|
||||||
|
1,
|
||||||
|
(A.zx()*A.xy() - A.xx()*A.zy())/sd1
|
||||||
|
);
|
||||||
|
ev /= (mag(ev) + VSMALL);
|
||||||
|
|
||||||
|
return ev;
|
||||||
|
}
|
||||||
|
else if (magSd2 > SMALL)
|
||||||
|
{
|
||||||
|
vector ev
|
||||||
|
(
|
||||||
|
(A.xy()*A.yz() - A.yy()*A.xz())/sd2,
|
||||||
|
(A.yx()*A.xz() - A.xx()*A.yz())/sd2,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
ev /= (mag(ev) + VSMALL);
|
||||||
|
|
||||||
|
return ev;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return vector::zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<class Face1, class Face2>
|
template<class Face1, class Face2>
|
||||||
inline bool isSharedEdgeConvex
|
inline bool isSharedEdgeConvex
|
||||||
(
|
(
|
||||||
|
@ -1056,7 +1218,7 @@ inline bool doTrianglesOverlap
|
||||||
x /= (mag(x) + VSMALL);
|
x /= (mag(x) + VSMALL);
|
||||||
vector y = vec ^ x;
|
vector y = vec ^ x;
|
||||||
|
|
||||||
DynList<point2D, 6> poly2D(3);
|
DynList<point2D, 6> poly2D(label(3));
|
||||||
poly2D[0] = point2D((tri0.a() - origin) & x, (tri0.a() - origin) & y);
|
poly2D[0] = point2D((tri0.a() - origin) & x, (tri0.a() - origin) & y);
|
||||||
poly2D[1] = point2D((tri0.b() - origin) & x, (tri0.b() - origin) & y);
|
poly2D[1] = point2D((tri0.b() - origin) & x, (tri0.b() - origin) & y);
|
||||||
poly2D[2] = point2D((tri0.c() - origin) & x, (tri0.c() - origin) & y);
|
poly2D[2] = point2D((tri0.c() - origin) & x, (tri0.c() - origin) & y);
|
||||||
|
@ -1612,6 +1774,17 @@ inline bool isFaceConvexAndOk
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline scalar tetQuality(const tetrahedron<point, point>& tet)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
tet.mag()
|
||||||
|
/(
|
||||||
|
8.0/(9.0*sqrt(3.0))
|
||||||
|
*pow3(min(tet.circumRadius(), GREAT))
|
||||||
|
+ ROOTVSMALL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
inline point nearestPointOnTheEdge
|
inline point nearestPointOnTheEdge
|
||||||
(
|
(
|
||||||
const point& edgePoint0,
|
const point& edgePoint0,
|
||||||
|
|
|
@ -79,7 +79,7 @@ void whisperReduce(const ListType& neis, const scatterOp& sop, gatherOp& gop)
|
||||||
{
|
{
|
||||||
//- receive the data
|
//- receive the data
|
||||||
List<T> receivedData;
|
List<T> receivedData;
|
||||||
IPstream fromOtherProc(Pstream::blocking, above[aboveI]);
|
IPstream fromOtherProc(Pstream::commsTypes::blocking, above[aboveI]);
|
||||||
fromOtherProc >> receivedData;
|
fromOtherProc >> receivedData;
|
||||||
|
|
||||||
gop(receivedData);
|
gop(receivedData);
|
||||||
|
@ -94,7 +94,13 @@ void whisperReduce(const ListType& neis, const scatterOp& sop, gatherOp& gop)
|
||||||
sop(dts);
|
sop(dts);
|
||||||
|
|
||||||
//- send the data
|
//- send the data
|
||||||
OPstream toOtherProc(Pstream::blocking, neiProc, dts.byteSize());
|
OPstream toOtherProc
|
||||||
|
(
|
||||||
|
Pstream::commsTypes::blocking,
|
||||||
|
neiProc,
|
||||||
|
dts.byteSize()
|
||||||
|
);
|
||||||
|
|
||||||
toOtherProc << dts;
|
toOtherProc << dts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +110,7 @@ void whisperReduce(const ListType& neis, const scatterOp& sop, gatherOp& gop)
|
||||||
{
|
{
|
||||||
//- receive the data
|
//- receive the data
|
||||||
List<T> receivedData;
|
List<T> receivedData;
|
||||||
IPstream fromOtherProc(Pstream::blocking, below[belowI]);
|
IPstream fromOtherProc(Pstream::commsTypes::blocking, below[belowI]);
|
||||||
fromOtherProc >> receivedData;
|
fromOtherProc >> receivedData;
|
||||||
|
|
||||||
gop(receivedData);
|
gop(receivedData);
|
||||||
|
@ -119,7 +125,13 @@ void whisperReduce(const ListType& neis, const scatterOp& sop, gatherOp& gop)
|
||||||
sop(dts);
|
sop(dts);
|
||||||
|
|
||||||
//- send the data
|
//- send the data
|
||||||
OPstream toOtherProc(Pstream::blocking, neiProc, dts.byteSize());
|
OPstream toOtherProc
|
||||||
|
(
|
||||||
|
Pstream::commsTypes::blocking,
|
||||||
|
neiProc,
|
||||||
|
dts.byteSize()
|
||||||
|
);
|
||||||
|
|
||||||
toOtherProc << dts;
|
toOtherProc << dts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,14 +155,24 @@ void exchangeMap
|
||||||
labelHashSet receiveData;
|
labelHashSet receiveData;
|
||||||
for(iter=m.begin();iter!=m.end();++iter)
|
for(iter=m.begin();iter!=m.end();++iter)
|
||||||
{
|
{
|
||||||
OPstream toOtherProc(Pstream::blocking, iter->first, sizeof(label));
|
OPstream toOtherProc
|
||||||
|
(
|
||||||
|
Pstream::commsTypes::blocking,
|
||||||
|
iter->first,
|
||||||
|
sizeof(label)
|
||||||
|
);
|
||||||
|
|
||||||
toOtherProc << iter->second.size();
|
toOtherProc << iter->second.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(iter=m.begin();iter!=m.end();++iter)
|
for(iter=m.begin();iter!=m.end();++iter)
|
||||||
{
|
{
|
||||||
IPstream fromOtherProc(Pstream::blocking, iter->first, sizeof(label));
|
IPstream fromOtherProc
|
||||||
|
(
|
||||||
|
Pstream::commsTypes::blocking,
|
||||||
|
iter->first,
|
||||||
|
sizeof(label)
|
||||||
|
);
|
||||||
|
|
||||||
label s;
|
label s;
|
||||||
fromOtherProc >> s;
|
fromOtherProc >> s;
|
||||||
|
@ -159,7 +181,7 @@ void exchangeMap
|
||||||
receiveData.insert(iter->first);
|
receiveData.insert(iter->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( commsType == Pstream::blocking )
|
if( commsType == Pstream::commsTypes::blocking )
|
||||||
{
|
{
|
||||||
//- start with blocking type of send and received operation
|
//- start with blocking type of send and received operation
|
||||||
|
|
||||||
|
@ -173,7 +195,7 @@ void exchangeMap
|
||||||
|
|
||||||
OPstream toOtherProc
|
OPstream toOtherProc
|
||||||
(
|
(
|
||||||
Pstream::blocking,
|
Pstream::commsTypes::blocking,
|
||||||
iter->first,
|
iter->first,
|
||||||
dts.byteSize()
|
dts.byteSize()
|
||||||
);
|
);
|
||||||
|
@ -186,11 +208,16 @@ void exchangeMap
|
||||||
if( !receiveData.found(iter->first) )
|
if( !receiveData.found(iter->first) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
IPstream fromOtherProc(Pstream::blocking, iter->first);
|
IPstream fromOtherProc
|
||||||
|
(
|
||||||
|
Pstream::commsTypes::blocking,
|
||||||
|
iter->first
|
||||||
|
);
|
||||||
|
|
||||||
data.appendFromStream(fromOtherProc);
|
data.appendFromStream(fromOtherProc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( commsType == Pstream::scheduled )
|
else if( commsType == Pstream::commsTypes::scheduled )
|
||||||
{
|
{
|
||||||
//- start with scheduled data transfer
|
//- start with scheduled data transfer
|
||||||
//- this type of transfer is intended for long messages because
|
//- this type of transfer is intended for long messages because
|
||||||
|
@ -204,13 +231,13 @@ void exchangeMap
|
||||||
if( !receiveData.found(iter->first) )
|
if( !receiveData.found(iter->first) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//List<T> receive;
|
IPstream fromOtherProc
|
||||||
IPstream fromOtherProc(Pstream::scheduled, iter->first);
|
(
|
||||||
//fromOtherProc >> receive;
|
Pstream::commsTypes::scheduled,
|
||||||
data.appendFromStream(fromOtherProc);
|
iter->first
|
||||||
|
);
|
||||||
|
|
||||||
//forAll(receive, i)
|
data.appendFromStream(fromOtherProc);
|
||||||
// data.append(receive[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//- send data to processors with greater ids
|
//- send data to processors with greater ids
|
||||||
|
@ -226,7 +253,7 @@ void exchangeMap
|
||||||
|
|
||||||
OPstream toOtherProc
|
OPstream toOtherProc
|
||||||
(
|
(
|
||||||
Pstream::scheduled,
|
Pstream::commsTypes::scheduled,
|
||||||
iter->first,
|
iter->first,
|
||||||
dts.byteSize()
|
dts.byteSize()
|
||||||
);
|
);
|
||||||
|
@ -243,13 +270,13 @@ void exchangeMap
|
||||||
if( !receiveData.found(riter->first) )
|
if( !receiveData.found(riter->first) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
IPstream fromOtherProc(Pstream::scheduled, riter->first);
|
IPstream fromOtherProc
|
||||||
//List<T> receive;
|
(
|
||||||
//fromOtherProc >> receive;
|
Pstream::commsTypes::scheduled,
|
||||||
data.appendFromStream(fromOtherProc);
|
riter->first
|
||||||
|
);
|
||||||
|
|
||||||
//forAll(receive, i)
|
data.appendFromStream(fromOtherProc);
|
||||||
// data.append(receive[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//- send data to processors with lower ids
|
//- send data to processors with lower ids
|
||||||
|
@ -265,7 +292,7 @@ void exchangeMap
|
||||||
|
|
||||||
OPstream toOtherProc
|
OPstream toOtherProc
|
||||||
(
|
(
|
||||||
Pstream::scheduled,
|
Pstream::commsTypes::scheduled,
|
||||||
riter->first,
|
riter->first,
|
||||||
dts.byteSize()
|
dts.byteSize()
|
||||||
);
|
);
|
||||||
|
@ -317,7 +344,7 @@ void exchangeMap
|
||||||
|
|
||||||
OPstream toOtherProc
|
OPstream toOtherProc
|
||||||
(
|
(
|
||||||
Pstream::blocking,
|
Pstream::commsTypes::blocking,
|
||||||
iter->first,
|
iter->first,
|
||||||
dataToSend.byteSize()
|
dataToSend.byteSize()
|
||||||
);
|
);
|
||||||
|
@ -330,7 +357,12 @@ void exchangeMap
|
||||||
mOut.insert(std::make_pair(iter->first, List<T>()));
|
mOut.insert(std::make_pair(iter->first, List<T>()));
|
||||||
List<T>& dataToReceive = mOut[iter->first];
|
List<T>& dataToReceive = mOut[iter->first];
|
||||||
|
|
||||||
IPstream fromOtherProc(Pstream::blocking, iter->first);
|
IPstream fromOtherProc
|
||||||
|
(
|
||||||
|
Pstream::commsTypes::blocking,
|
||||||
|
iter->first
|
||||||
|
);
|
||||||
|
|
||||||
fromOtherProc >> dataToReceive;
|
fromOtherProc >> dataToReceive;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ void exchangeMap
|
||||||
(
|
(
|
||||||
const std::map<label, ListType>&,
|
const std::map<label, ListType>&,
|
||||||
LongList<T>&,
|
LongList<T>&,
|
||||||
const Pstream::commsTypes commsType = Pstream::blocking
|
const Pstream::commsTypes commsType = Pstream::commsTypes::blocking
|
||||||
);
|
);
|
||||||
|
|
||||||
//- sends the data stored in a map to other processors and receives the data
|
//- sends the data stored in a map to other processors and receives the data
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -488,7 +488,7 @@ inline void zipOpenChain(DynList<edge>& bEdges)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool closed(true);
|
bool closed(true);
|
||||||
DynList<label> openVertices(2);
|
DynList<label> openVertices(label(2));
|
||||||
forAll(chainVertices, pI)
|
forAll(chainVertices, pI)
|
||||||
if( nAppearances[pI] == 1 )
|
if( nAppearances[pI] == 1 )
|
||||||
{
|
{
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue