Bugfix: update cfMesh to v1.1 which fixes self-comparison always evaluates to false [-Wtautological-compare]

This commit is contained in:
Danial Khazaei 2019-01-31 17:52:39 +03:30
parent b9ba5ebf2e
commit 5f08a2f90a
No known key found for this signature in database
GPG key ID: 0EF86F9BFB18F88C
305 changed files with 164476 additions and 162251 deletions

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Reads the AVL's surface mesh
@ -27,8 +27,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "triSurf.H"
#include "triSurfModifier.H"
#include "triFaceList.H"

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Creates surface patches from surface subsets
@ -27,8 +27,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "triSurf.H"
#include "triSurfaceCopyParts.H"
#include "demandDrivenData.H"

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
cfMesh utility to convert a surface file to VTK multiblock dataset
@ -45,29 +45,29 @@ using namespace Foam;
void writePointsToVTK
(
const fileName& fn,
const string& title,
const string& /*title*/,
const UList<point>& points
)
{
xmlTag xmlRoot("VTKFile");
xmlRoot.addAttribute("type", "PolyData");
xmlTag& xmlPolyData = xmlRoot.addChild("PolyData");
xmlTag& xmlPiece = xmlPolyData.addChild("Piece");
xmlPiece.addAttribute("NumberOfPoints", points.size());
xmlTag& xmlPoints = xmlPiece.addChild("Points");
xmlTag& xmlPointData = xmlPoints.addChild("DataArray");
xmlPointData.addAttribute("type", "Float32");
xmlPointData.addAttribute("NumberOfComponents", 3);
xmlPointData.addAttribute("format", "ascii");
xmlPointData << points;
OFstream os(fn);
os << xmlRoot << endl;
Info << "Created " << fn << endl;
}
@ -78,17 +78,17 @@ void writePointsToVTK
const fileName& fn,
const string& title,
const UList<point>& points,
unallocLabelList& addr
UList<label>& addr
)
{
// Create subaddressed points
pointField newPoints(addr.size());
forAll(addr, i)
{
newPoints[i] = points[addr[i]];
}
writePointsToVTK
(
fn,
@ -102,29 +102,29 @@ void writePointsToVTK
void writeEdgesToVTK
(
const fileName& fn,
const string& title,
const string& /*title*/,
const UList<point>& points,
const LongList<edge>& edges
)
{
labelList connectivity(edges.size());
forAll(edges, edgeI)
{
connectivity[edgeI] = 2*(edgeI+1);
}
xmlTag xmlRoot("VTKFile");
xmlRoot.addAttribute("type", "PolyData");
xmlTag& xmlPolyData = xmlRoot.addChild("PolyData");
xmlTag& xmlPiece = xmlPolyData.addChild("Piece");
xmlPiece.addAttribute("NumberOfPoints", points.size());
xmlPiece.addAttribute("NumberOfLines", edges.size());
xmlTag& xmlPoints = xmlPiece.addChild("Points");
xmlTag& xmlPointData = xmlPoints.addChild("DataArray");
xmlPointData.addAttribute("type", "Float32");
xmlPointData.addAttribute("NumberOfComponents", 3);
@ -144,7 +144,7 @@ void writeEdgesToVTK
xmlConnectData.addAttribute("Name", "offsets");
xmlConnectData.addAttribute("format", "ascii");
xmlConnectData << connectivity;
OFstream os(fn);
os << xmlRoot << endl;
@ -158,35 +158,35 @@ void writeEdgesToVTK
const string& title,
const UList<point>& points,
const LongList<edge>& edges,
const unallocLabelList& addr
const UList<label>& addr
)
{
// Remove unused points and create subaddressed edges
DynamicList<point> newPoints;
labelList newPointAddr(points.size(), -1);
LongList<edge> newEdges(addr.size());
forAll(addr, addrI)
{
label edgeI = addr[addrI];
const edge& curEdge = edges[edgeI];
edge& newEdge = newEdges[addrI];
forAll(curEdge, i)
{
label pointId = curEdge[i];
if (newPointAddr[pointId] == -1)
{
newPoints.append(points[pointId]);
newPointAddr[pointId] = newPoints.size()-1;
}
newEdge[i] = newPointAddr[pointId];
}
}
writeEdgesToVTK
(
fn,
@ -201,36 +201,36 @@ void writeEdgesToVTK
void writeFacetsToVTK
(
const fileName& fn,
const string& title,
const string& /*title*/,
const UList<point>& points,
const LongList<labelledTri>& facets
)
{
labelList connectivity(facets.size());
forAll(facets, faceI)
{
connectivity[faceI] = 3*(faceI+1);
}
labelList regionData(facets.size());
forAll(facets, faceI)
{
regionData[faceI] = facets[faceI].region();
}
xmlTag xmlRoot("VTKFile");
xmlRoot.addAttribute("type", "PolyData");
xmlTag& xmlPolyData = xmlRoot.addChild("PolyData");
xmlTag& xmlPiece = xmlPolyData.addChild("Piece");
xmlPiece.addAttribute("NumberOfPoints", points.size());
xmlPiece.addAttribute("NumberOfPolys", facets.size());
xmlTag& xmlPoints = xmlPiece.addChild("Points");
xmlTag& xmlPointData = xmlPoints.addChild("DataArray");
xmlPointData.addAttribute("type", "Float32");
xmlPointData.addAttribute("NumberOfComponents", 3);
@ -250,18 +250,18 @@ void writeFacetsToVTK
xmlConnectData.addAttribute("Name", "offsets");
xmlConnectData.addAttribute("format", "ascii");
xmlConnectData << connectivity;
xmlTag& xmlCellData = xmlPiece.addChild("CellData");
xmlTag& xmlCellDataArray = xmlCellData.addChild("DataArray");
xmlCellDataArray.addAttribute("type", "Int32");
xmlCellDataArray.addAttribute("Name", "region");
xmlCellDataArray.addAttribute("format", "ascii");
xmlCellDataArray << regionData;
OFstream os(fn);
os << xmlRoot << endl;
Info << "Created " << fn << endl;
}
@ -274,35 +274,35 @@ void writeFacetsToVTK
const string& title,
const pointField& points,
const LongList<labelledTri>& facets,
const unallocLabelList& addr
const UList<label>& addr
)
{
{
// Remove unused points and create subaddressed facets
DynamicList<point> newPoints;
labelList newPointAddr(points.size(), -1);
LongList<labelledTri> newFacets(addr.size());
forAll(addr, addrI)
{
label faceI = addr[addrI];
const labelledTri& facet = facets[faceI];
const FixedList<label, 3>& pointIds = facet;
FixedList<label, 3> newPointIds;
forAll(pointIds, i)
{
label pointId = pointIds[i];
if (newPointAddr[pointId] == -1)
{
newPoints.append(points[pointId]);
newPointAddr[pointId] = newPoints.size()-1;
}
newPointIds[i] = newPointAddr[pointId];
}
newFacets[addrI] = labelledTri
(
newPointIds[0],
@ -311,7 +311,7 @@ void writeFacetsToVTK
facet.region()
);
}
writeFacetsToVTK
(
fn,
@ -334,36 +334,36 @@ int main(int argc, char *argv[])
// Process commandline arguments
fileName inFileName(args.args()[1]);
fileName outPrefix(args.args()[2]);
// Read original surface
triSurf origSurf(inFileName);
const pointField& points = origSurf.points();
const LongList<labelledTri>& facets = origSurf.facets();
const LongList<edge>& edges = origSurf.featureEdges();
const geometricSurfacePatchList& patches = origSurf.patches();
label index = 0;
// Create file structure for multiblock dataset
mkDir(outPrefix);
mkDir(outPrefix + "/patches");
mkDir(outPrefix + "/pointSubsets");
mkDir(outPrefix + "/edgeSubsets");
mkDir(outPrefix + "/faceSubsets");
// Create VTK multiblock dataset file
xmlTag xmlRoot("VTKFile");
xmlRoot.addAttribute("type", "vtkMultiBlockDataSet");
xmlRoot.addAttribute("version", "1.0");
xmlRoot.addAttribute("byte_order", "LittleEndian");
xmlTag& xmlDataSet = xmlRoot.addChild("vtkMultiBlockDataSet");
// Write faces and feature edges
{
fileName fn = outPrefix / "facets.vtp";
writeFacetsToVTK
(
outPrefix / "facets.vtp",
@ -371,16 +371,16 @@ int main(int argc, char *argv[])
points,
facets
);
xmlTag& tag = xmlDataSet.addChild("DataSet");
tag.addAttribute("index", Foam::name(index++));
tag.addAttribute("name", "facets");
tag.addAttribute("file", fn);
}
{
fileName fn = outPrefix / "featureEdges.vtp";
writeEdgesToVTK
(
outPrefix / "featureEdges.vtp",
@ -388,33 +388,33 @@ int main(int argc, char *argv[])
points,
edges
);
xmlTag& tag = xmlDataSet.addChild("DataSet");
tag.addAttribute("index", Foam::name(index++));
tag.addAttribute("name", "featureEdges");
tag.addAttribute("file", fn);
}
// Write patches
// Create patch addressing
List<DynamicList<label> > patchAddr(patches.size());
forAll(facets, faceI)
{
patchAddr[facets[faceI].region()].append(faceI);
}
{
xmlTag& xmlBlock = xmlDataSet.addChild("Block");
xmlBlock.addAttribute("index", Foam::name(index++));
xmlBlock.addAttribute("name", "patches");
forAll(patches, patchI)
{
{
word patchName = patches[patchI].name();
fileName fn = outPrefix / "patches" / patchName + ".vtp";
writeFacetsToVTK
(
fn,
@ -423,32 +423,32 @@ int main(int argc, char *argv[])
facets,
patchAddr[patchI]
);
xmlTag& tag = xmlBlock.addChild("DataSet");
tag.addAttribute("index", Foam::name(patchI));
tag.addAttribute("name", patchName);
tag.addAttribute("file", fn);
}
}
// Write point subsets
{
xmlTag& xmlBlock = xmlDataSet.addChild("Block");
xmlBlock.addAttribute("index", Foam::name(index++));
xmlBlock.addAttribute("name", "pointSubsets");
DynList<label> subsetIndices;
labelList subsetAddr;
origSurf.pointSubsetIndices(subsetIndices);
forAll(subsetIndices, id)
{
word subsetName = origSurf.pointSubsetName(id);
origSurf.pointsInSubset(id, subsetAddr);
fileName fn = outPrefix / "pointSubsets" / subsetName + ".vtp";
writePointsToVTK
(
fn,
@ -456,32 +456,32 @@ int main(int argc, char *argv[])
points,
subsetAddr
);
xmlTag& tag = xmlBlock.addChild("DataSet");
tag.addAttribute("index", Foam::name(id));
tag.addAttribute("name", subsetName);
tag.addAttribute("file", fn);
}
}
// Write edge subsets
{
xmlTag& xmlBlock = xmlDataSet.addChild("Block");
xmlBlock.addAttribute("index", Foam::name(index++));
xmlBlock.addAttribute("name", "edgeSubsets");
DynList<label> subsetIndices;
labelList subsetAddr;
origSurf.edgeSubsetIndices(subsetIndices);
forAll(subsetIndices, id)
{
word subsetName = origSurf.edgeSubsetName(id);
origSurf.edgesInSubset(id, subsetAddr);
fileName fn = outPrefix / "edgeSubsets" / subsetName + ".vtp";
writeEdgesToVTK
(
fn,
@ -490,32 +490,32 @@ int main(int argc, char *argv[])
edges,
subsetAddr
);
xmlTag& tag = xmlBlock.addChild("DataSet");
tag.addAttribute("index", Foam::name(id));
tag.addAttribute("name", subsetName);
tag.addAttribute("file", fn);
}
}
// Write facet subsets
{
xmlTag& xmlBlock = xmlDataSet.addChild("Block");
xmlBlock.addAttribute("index", Foam::name(index++));
xmlBlock.addAttribute("name", "faceSubsets");
DynList<label> subsetIndices;
labelList subsetAddr;
origSurf.facetSubsetIndices(subsetIndices);
forAll(subsetIndices, id)
{
{
word subsetName = origSurf.facetSubsetName(id);
origSurf.facetsInSubset(id, subsetAddr);
fileName fn = outPrefix / "faceSubsets" / subsetName + ".vtp";
writeFacetsToVTK
(
fn,
@ -524,21 +524,21 @@ int main(int argc, char *argv[])
facets,
subsetAddr
);
xmlTag& tag = xmlBlock.addChild("DataSet");
tag.addAttribute("index", Foam::name(id));
tag.addAttribute("name", subsetName);
tag.addAttribute("file", fn);
}
}
}
OFstream os(outPrefix + ".vtm");
os << xmlRoot << endl;
Info << "Created " << outPrefix + ".vtm" << endl;
Info << "End\n" << endl;
return 0;
}

View file

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

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Application
Generates cartesian mesh
@ -30,8 +30,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "cartesian2DMeshGenerator.H"
using namespace Foam;

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Application
Generates cartesian mesh
@ -30,8 +30,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "cartesianMeshGenerator.H"
using namespace Foam;

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Finds feature edges and corners of a triangulated surface

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Reads the surface mesh, remove the selected facets
@ -28,8 +28,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "triSurf.H"
#include "triSurfaceExtrude2DEdges.H"
#include "demandDrivenData.H"

View file

@ -28,8 +28,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGenModifier.H"
#include "meshOptimizer.H"
#include "boundaryLayers.H"

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Finds feature edges and corners of a triangulated surface

View file

@ -28,8 +28,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGenModifier.H"
#include "meshOptimizer.H"

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Ensures that all mesh points belonging to a symmetryPlane are
@ -28,8 +28,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGenModifier.H"
#include "symmetryPlaneOptimisation.H"

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
cfMesh utility to merge the supplied list of patches onto a single
@ -31,8 +31,6 @@ Author
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "autoPtr.H"
#include "triSurf.H"
#include "triSurfModifier.H"
@ -52,10 +50,10 @@ void getPatchIds
)
{
const geometricSurfacePatchList& origPatches = origSurf.patches();
// Create patch name map
HashSet<word> patchNameHash(patchNames);
// Find selected patches
label nFound = 0;
forAll(origPatches, patchI)
@ -66,7 +64,7 @@ void getPatchIds
nFound++;
}
}
if (nFound != patchNames.size())
{
WarningIn("getPatchIds")
@ -84,17 +82,17 @@ void copyFaceSubsets
{
DynList<label> subsetIds;
origSurf.facetSubsetIndices(subsetIds);
forAll(subsetIds, subsetI)
{
label newSubsetId = newSurf.addFacetSubset
(
origSurf.facetSubsetName(subsetI)
);
labelList origFaces;
labelList origFaces;
origSurf.facetsInSubset(subsetI, origFaces);
forAll(origFaces, faceI)
{
newSurf.addFacetToSubset
@ -116,17 +114,17 @@ void copyEdgeSubsets
{
DynList<label> subsetIds;
origSurf.edgeSubsetIndices(subsetIds);
forAll(subsetIds, subsetI)
{
label newSubsetId = newSurf.addEdgeSubset
(
origSurf.edgeSubsetName(subsetI)
);
labelList origEdges;
labelList origEdges;
origSurf.edgesInSubset(subsetI, origEdges);
forAll(origEdges, faceI)
{
newSurf.addEdgeToSubset
@ -148,17 +146,17 @@ void copyPointSubsets
{
DynList<label> subsetIds;
origSurf.pointSubsetIndices(subsetIds);
forAll(subsetIds, subsetI)
{
label newSubsetId = newSurf.addPointSubset
(
origSurf.pointSubsetName(subsetI)
);
labelList origPoints;
labelList origPoints;
origSurf.pointsInSubset(subsetI, origPoints);
forAll(origPoints, faceI)
{
newSurf.addPointToSubset
@ -182,20 +180,20 @@ autoPtr<triSurf> mergeSurfacePatches
{
const geometricSurfacePatchList& origPatches = origSurf.patches();
const LongList<labelledTri>& origFacets = origSurf.facets();
label newPatchId = origPatches.size();
// Determine new patch type
word newPatchType = origPatches[patchIds[0]].geometricType();
// Create patch addressing
List<DynamicList<label> > patchAddr(origPatches.size()+1);
forAll(origFacets, faceI)
{
patchAddr[origFacets[faceI].region()].append(faceI);
}
// Move selected patches to new patch
forAll(patchIds, patchI)
{
@ -206,35 +204,35 @@ autoPtr<triSurf> mergeSurfacePatches
// Create new facets list
LongList<labelledTri> newFacets(origFacets.size());
labelList newFaceAddr(origFacets.size(), -1);
label patchCount = 0;
label faceI = 0;
forAll(patchAddr, patchI)
{
const unallocLabelList& addr = patchAddr[patchI];
const UList<label>& addr = patchAddr[patchI];
if(addr.size())
{
forAll(addr, i)
{
newFacets[faceI] = origFacets[addr[i]];
newFacets[faceI].region() = patchCount;
newFaceAddr[addr[i]] = faceI;
faceI++;
}
}
if(addr.size() || keepPatches)
{
patchCount++;
}
}
// Create new patch list
geometricSurfacePatchList newPatches(patchCount);
patchCount = 0;
forAll(origPatches, patchI)
{
@ -244,13 +242,13 @@ autoPtr<triSurf> mergeSurfacePatches
newPatches[patchCount] = origPatches[patchI];
newPatches[patchCount].index() = patchCount;
}
if(patchAddr[patchI].size() || keepPatches)
{
patchCount++;
}
}
// Add new patch if it contains faces
if(patchAddr[patchAddr.size()-1].size())
{
@ -265,7 +263,7 @@ autoPtr<triSurf> mergeSurfacePatches
{
patchCount++;
}
// Create new surface
autoPtr<triSurf> newSurf
(
@ -277,17 +275,17 @@ autoPtr<triSurf> mergeSurfacePatches
origSurf.points()
)
);
// Transfer face subsets
copyFaceSubsets(origSurf, newSurf());
newSurf->updateFacetsSubsets(newFaceAddr);
// Transfer feature edge subsets
copyEdgeSubsets(origSurf, newSurf());
// Transfer point subsets
copyPointSubsets(origSurf, newSurf());
// Done
return newSurf;
}
@ -310,18 +308,18 @@ int main(int argc, char *argv[])
// Process commandline arguments
fileName inFileName(args.args()[1]);
word newPatchName(args.args()[2]);
fileName outFileName(inFileName);
if( args.options().found("output") )
{
outFileName = args.options()["output"];
}
bool keepPatches = false;
if( args.options().found("keep") )
{
keepPatches = true;
@ -329,10 +327,10 @@ int main(int argc, char *argv[])
// Read original surface
triSurf origSurf(inFileName);
// Get patch ids
DynamicList<label> patchIds;
if (args.options().found("patchNames"))
{
if (args.options().found("patchIds"))
@ -340,10 +338,10 @@ int main(int argc, char *argv[])
FatalError() << "Cannot specify both patch names and ids"
<< Foam::abort(FatalError);
}
IStringStream is(args.options()["patchNames"]);
wordList patchNames(is);
getPatchIds
(
origSurf,
@ -354,32 +352,32 @@ int main(int argc, char *argv[])
if (args.options().found("patchIds"))
{
IStringStream is(args.options()["patchIds"]);
patchIds = labelList(is);
}
if (args.options().found("patchIds"))
{
IStringStream is(args.options()["patchIds"]);
patchIds.append(labelList(is));
}
if (args.options().found("patchIdRange"))
{
IStringStream is(args.options()["patchIdRange"]);
Pair<label> idRange(is);
for(label id = idRange.first(); id <= idRange.second(); id++)
{
patchIds.append(id);
}
}
}
if (!patchIds.size())
{
FatalError() << "No patches specified"
<< Foam::abort(FatalError);
}
// Merge patches
autoPtr<triSurf> newSurf = mergeSurfacePatches
(
@ -388,16 +386,16 @@ int main(int argc, char *argv[])
newPatchName,
keepPatches
);
// Write new surface mesh
newSurf->writeSurface(outFileName);
Info << "Original surface patches: " << origSurf.patches().size() << endl;
Info << "Final surface patches: " << newSurf->patches().size() << endl;
Info << "Surface written to " << outFileName << endl;
Info << "End\n" << endl;
return 0;
}

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Writes the mesh in fpma format readable by AVL's CfdWM
@ -27,8 +27,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGenModifier.H"
#include "writeMeshFPMA.H"
@ -43,15 +41,15 @@ int main(int argc, char *argv[])
polyMeshGen pmg(runTime);
pmg.read();
if( Pstream::parRun() )
{
polyMeshGenModifier(pmg).addBufferCells();
createFIRESelections(pmg);
}
writeMeshFPMA(pmg, "convertedMesh");
Info << "End\n" << endl;
return 0;
}

View file

@ -30,8 +30,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "voronoiMeshGenerator.H"
using namespace Foam;

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Converts specified patches into subsets
@ -27,8 +27,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "triSurf.H"
#include "triFaceList.H"
#include "labelLongList.H"

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Application
Prepares the case for a parallel mesh generation run
@ -30,8 +30,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGen.H"
#include <sstream>
@ -83,16 +82,13 @@ int main(int argc, char *argv[])
file += ss.str();
Info << "Creating " << file << endl;
// create a directory for processor data
//- create a directory for processor data
mkDir(runTime.path()/file);
// generate constant directories
mkDir(runTime.path()/"constant");
// copy the contents of the const directory into processor*
//- copy the contents of the const directory into processor*
cp(runTime.path()/"constant", runTime.path()/file);
// generate 0 directories
//- generate 0 directories for
mkDir(runTime.path()/file/"0");
}

View file

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

View file

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

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Reads the surface mesh, remove the selected facets
@ -28,8 +28,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "triSurf.H"
#include "triSurfaceRemoveFacets.H"

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Creates surface patches from surface subsets
@ -27,8 +27,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "triSurf.H"
#include "demandDrivenData.H"

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Finds feature edges and corners of a triangulated surface

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Finds feature edges and corners of a triangulated surface
@ -29,14 +29,14 @@ Description
#include "argList.H"
#include "IFstream.H"
#include "fileName.H"
#include "triSurf.H"
#include "triSurfModifier.H"
#include "boundBox.H"
#include "OFstream.H"
#include <cstdlib>
#include <sstream>
#include "triSurfaceDetectFeatureEdges.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
using namespace Foam;
@ -121,12 +121,12 @@ int main(int argc, char *argv[])
//- generate bounding bound triangles
const label nTriangles = origSurface.size();
LongList<labelledTri>& newTriangles = sMod.facetsAccess();
newTriangles.setSize(nTriangles + 12);
newTriangles.setSize(nTriangles+12);
//- create patches
geometricSurfacePatchList& newPatches = sMod.patchesAccess();
const label nPatches = origSurface.patches().size();
newPatches.setSize(nPatches + 6);
newPatches.setSize(nPatches+6);
newPatches[nPatches].name() = "xMin";
newPatches[nPatches+1].name() = "xMax";

View file

@ -1,28 +1,28 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Reads the specified surface and writes it in the fms format.
Reads the specified surface and writes it in the fms format.
\*---------------------------------------------------------------------------*/

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of 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
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.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Application
Generates tetrahedral mesh
@ -30,8 +30,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "objectRegistry.H"
#include "foamTime.H"
#include "tetMeshGenerator.H"
using namespace Foam;

View file

@ -32,7 +32,6 @@ Description
#include "triSurfacePatchManipulator.H"
#include "triSurfaceCleanupDuplicateTriangles.H"
#include "demandDrivenData.H"
#include "foamTime.H"
#include "meshOctreeCreator.H"
#include "cartesianMeshExtractor.H"
#include "meshSurfaceEngine.H"
@ -188,7 +187,7 @@ void cartesian2DMeshGenerator::refBoundaryLayers()
void cartesian2DMeshGenerator::replaceBoundaries()
{
renameBoundaryPatches rbp(mesh_, meshDict_);
renameBoundaryPatches rbp(mesh_, meshDict_, true);
}
void cartesian2DMeshGenerator::renumberMesh()
@ -198,67 +197,53 @@ void cartesian2DMeshGenerator::renumberMesh()
void cartesian2DMeshGenerator::generateMesh()
{
try
if( controller_.runCurrentStep("templateGeneration") )
{
if( controller_.runCurrentStep("templateGeneration") )
{
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();
createCartesianMesh();
}
catch(const std::string& message)
if( controller_.runCurrentStep("surfaceTopology") )
{
Info << message << endl;
surfacePreparation();
}
catch(...)
if( controller_.runCurrentStep("surfaceProjection") )
{
WarningIn
(
"void cartesian2DMeshGenerator::generateMesh()"
) << "Meshing process terminated!" << endl;
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();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -283,70 +268,87 @@ cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time& time)
mesh_(time),
controller_(mesh_)
{
if( true )
try
{
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);
triSurface2DCheck surfCheck(*surfacePtr_);
if( !surfCheck.is2DSurface() )
if( true )
{
surfCheck.createSubsets();
Info << "Writting surface with subsets to file "
<< "badSurfaceWithSubsets.fms" << endl;
surfacePtr_->writeSurface("badSurfaceWithSubsets.fms");
checkMeshDict cmd(meshDict_);
}
}
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
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;
Info << message << endl;
}
if( meshDict_.found("anisotropicSources") )
catch(...)
{
surfaceMeshGeometryModification surfMod(*surfacePtr_, meshDict_);
modSurfacePtr_ = surfMod.modifyGeometry();
octreePtr_ = new meshOctree(*modSurfacePtr_, true);
WarningIn
(
"cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time&)"
) << "Meshing process terminated!" << endl;
}
else
{
octreePtr_ = new meshOctree(*surfacePtr_, true);
}
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
generateMesh();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View file

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

View file

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

View file

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

View file

@ -418,8 +418,8 @@ void cartesianMeshExtractor::createPolyMesh()
newFacePatch
);
meshModifier.boundariesAccess()[1].patchType() = "patch";
meshModifier.boundariesAccess()[2].patchType() = "patch";
meshModifier.boundariesAccess()[1].patchType() = "empty";
meshModifier.boundariesAccess()[2].patchType() = "empty";
}
Info << "Finished creating polyMesh" << endl;

View file

@ -29,7 +29,6 @@ Description
#include "triSurf.H"
#include "triSurfacePatchManipulator.H"
#include "demandDrivenData.H"
#include "foamTime.H"
#include "meshOctreeCreator.H"
#include "cartesianMeshExtractor.H"
#include "meshSurfaceEngine.H"
@ -247,69 +246,55 @@ void cartesianMeshGenerator::renumberMesh()
void cartesianMeshGenerator::generateMesh()
{
try
if( controller_.runCurrentStep("templateGeneration") )
{
if( controller_.runCurrentStep("templateGeneration") )
{
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();
createCartesianMesh();
}
catch(const std::string& message)
if( controller_.runCurrentStep("surfaceTopology") )
{
Info << message << endl;
surfacePreparation();
}
catch(...)
if( controller_.runCurrentStep("surfaceProjection") )
{
WarningIn
(
"void cartesianMeshGenerator::generateMesh()"
) << "Meshing process terminated!" << endl;
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();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -334,57 +319,72 @@ cartesianMeshGenerator::cartesianMeshGenerator(const Time& time)
mesh_(time),
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();
}
fileName surfaceFile = meshDict_.lookup("surfaceFile");
if( Pstream::parRun() )
surfaceFile = ".."/surfaceFile;
surfacePtr_ = new triSurf(db_.path()/surfaceFile);
if( true )
catch(const std::string& message)
{
//- 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);
Info << "Here" << endl;
Info << message << endl;
}
if( surfacePtr_->featureEdges().size() != 0 )
catch(...)
{
//- 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;
WarningIn
(
"cartesianMeshGenerator::cartesianMeshGenerator(const Time&)"
) << "Meshing process terminated!" << endl;
}
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 * * * * * * * * * * * * * * * //

View file

@ -28,7 +28,6 @@ Description
#include "tetMeshGenerator.H"
#include "triSurf.H"
#include "demandDrivenData.H"
#include "foamTime.H"
#include "meshOctreeCreator.H"
#include "tetMeshExtractorOctree.H"
#include "meshSurfaceEngine.H"
@ -235,69 +234,55 @@ void tetMeshGenerator::renumberMesh()
void tetMeshGenerator::generateMesh()
{
try
if( controller_.runCurrentStep("templateGeneration") )
{
if( controller_.runCurrentStep("templateGeneration") )
{
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();
createTetMesh();
}
catch(const std::string& message)
if( controller_.runCurrentStep("surfaceTopology") )
{
Info << message << endl;
surfacePreparation();
}
catch(...)
if( controller_.runCurrentStep("surfaceProjection") )
{
WarningIn
(
"void tetMeshGenerator::generateMesh()"
) << "Meshing process terminated!" << endl;
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();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -323,55 +308,69 @@ tetMeshGenerator::tetMeshGenerator(const Time& time)
mesh_(time),
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();
}
const fileName surfaceFile = meshDict_.lookup("surfaceFile");
surfacePtr_ = new triSurf(runTime_.path()/surfaceFile);
if( true )
catch(const std::string& message)
{
//- 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);
Info << message << endl;
}
if( surfacePtr_->featureEdges().size() != 0 )
catch(...)
{
//- 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;
WarningIn
(
"tetMeshGenerator::tetMeshGenerator(const Time&)"
) << "Meshing process terminated!" << endl;
}
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 * * * * * * * * * * * * * * * //

View file

@ -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;

View file

@ -46,7 +46,7 @@ coordinateModification::coordinateModification()
coordinateModification::coordinateModification
(
const word& name,
const dictionary& dict
const dictionary& /*dict*/
)
:
name_(name)

View file

@ -36,8 +36,6 @@ SourceFiles
#ifndef coordinateModifier_H
#define coordinateModifier_H
#include "objectRegistry.H"
#include "foamTime.H"
#include "word.H"
#include "point.H"
#include "coordinateModificationList.H"

View file

@ -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;

View file

@ -35,8 +35,6 @@ SourceFiles
#ifndef boundaryLayers_H
#define boundaryLayers_H
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGenModifier.H"
#include "meshSurfaceEngine.H"
#include "meshSurfacePartitioner.H"

View file

@ -686,7 +686,7 @@ void boundaryLayers::createNewPartitionVerticesParallel
(
const labelLongList& procPoints,
const List<direction>& pVertices,
const boolList& treatPatches
const boolList& /*treatPatches*/
)
{
if( !Pstream::parRun() )

View file

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

View file

@ -374,7 +374,7 @@ void extrudeLayer::createNewVertices()
OPstream toOtherProc
(
Pstream::blocking,
Pstream::commsTypes::blocking,
procBoundaries[patchI].neiProcNo(),
globalLabels.byteSize()
);
@ -390,7 +390,7 @@ void extrudeLayer::createNewVertices()
labelList receivedData;
IPstream fromOtherProc
(
Pstream::blocking,
Pstream::commsTypes::blocking,
procBoundaries[patchI].neiProcNo()
);
@ -498,7 +498,7 @@ void extrudeLayer::createNewVertices()
DynList<label> edgeGroup;
edgeGroup.setSize(dEdges.size());
edgeGroup = -1;
edgeGroup = label(-1);
//- check edge connections and store all edges which can be reached
//- over other edges into the same group
@ -538,7 +538,7 @@ void extrudeLayer::createNewVertices()
//- find face groups from the groups assigned to dual edges
DynList<label> faceGroups;
faceGroups.setSize(pointFaces.sizeOfRow(pointI));
faceGroups = -1;
faceGroups = label(-1);
forAllRow(pointFaces, pointI, pfI)
{
@ -618,7 +618,7 @@ void extrudeLayer::createNewVertices()
//- assign groups to faces and cells
DynList<label> faceGroup;
faceGroup.setSize(pointFaces.sizeOfRow(pointI));
faceGroup = -1;
faceGroup = label(-1);
label group(0);
@ -1114,7 +1114,7 @@ void extrudeLayer::createLayerCells()
//- find labels of points
DynList<label> origFacePoints;
origFacePoints.setSize(pointFaces.sizeOfRow(pointI));
origFacePoints = -1;
origFacePoints = label(-1);
forAllRow(pointFaces, pointI, pfI)
{

View file

@ -36,8 +36,6 @@ SourceFiles
#ifndef extrudeLayer_H
#define extrudeLayer_H
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGenModifier.H"
#include "VRWGraphList.H"
#include "labelPair.H"

View file

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

View file

@ -36,8 +36,6 @@ SourceFiles
#ifndef refineBoundaryLayers_H
#define refineBoundaryLayers_H
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGenModifier.H"
#include "meshSurfaceEngine.H"
#include "DynList.H"

View file

@ -885,7 +885,7 @@ void refineBoundaryLayers::refineCornerHexCell::generateNewPoints()
forAll(cellPoints_[i], j)
{
cellPoints_[i][j].setSize(nLayersK_+1);
cellPoints_[i][j] = -1;
cellPoints_[i][j] = label(-1);
}
}

View file

@ -250,7 +250,7 @@ void refineBoundaryLayers::refineFace
forAll(facePoints, i)
{
facePoints[i].setSize(nLayersDir1+1);
facePoints[i] = -1;
facePoints[i] = label(-1);
}
//- add points in the matrix
@ -1049,7 +1049,7 @@ void refineBoundaryLayers::generateNewFaces()
OPstream toOtherProc
(
Pstream::blocking,
Pstream::commsTypes::blocking,
procBoundaries[patchI].neiProcNo(),
sendData.byteSize()
);
@ -1065,7 +1065,7 @@ void refineBoundaryLayers::generateNewFaces()
IPstream fromOtherProc
(
Pstream::blocking,
Pstream::commsTypes::blocking,
procBoundaries[patchI].neiProcNo()
);

View file

@ -269,7 +269,7 @@ bool refineBoundaryLayers::analyseLayers()
{
if( allZMin[patchI] ^ allZMax[patchI] )
{
nLayersAtPatch[patchI] = -1;
nLayersAtPatch[patchI] = label(-1);
layerAtPatch_[patchI].clear();
}
}
@ -599,7 +599,7 @@ void refineBoundaryLayers::generateNewVertices()
//- on edges of the mesh
DynList<label> numPointsAtThread;
numPointsAtThread.setSize(nThreads);
numPointsAtThread = 0;
numPointsAtThread = label(0);
# ifdef USE_OMP
# pragma omp parallel for num_threads(nThreads) schedule(static, 1)

View file

@ -36,8 +36,6 @@ SourceFiles
#ifndef triangulateNonPlanarBaseFaces_H
#define triangulateNonPlanarBaseFaces_H
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGenModifier.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -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
{
checkBasicSettings();
@ -785,6 +833,8 @@ void checkMeshDict::checkEntries() const
checkBoundaryLayers();
checkRenameBoundary();
checkQualitySettings();
}
void checkMeshDict::updatePatchCellSize
@ -860,7 +910,7 @@ void checkMeshDict::updatePatchCellSize
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
(
const std::map<word, wordList>& patchesFromPatch
const std::map<word, wordList>& /*patchesFromPatch*/
)
{

View file

@ -35,8 +35,6 @@ SourceFiles
#ifndef checkMeshDict_H
#define checkMeshDict_H
#include "objectRegistry.H"
#include "foamTime.H"
#include "IOdictionary.H"
#include <map>
@ -92,6 +90,9 @@ class checkMeshDict
//- check renameBoundary entry
void checkRenameBoundary() const;
//- check entry for mesh quality
void checkQualitySettings() const;
//- perform all checks
void checkEntries() const;

View file

@ -29,9 +29,11 @@ License
// Construct from Istream
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)
{
FatalErrorIn
@ -39,11 +41,6 @@ Foam::DynList<T, staticSize>::DynList(Istream& is)
"template<class T, Foam::label staticSize>"
"\nFoam::DynList<T, staticSize>::DynList(Istream& is)"
) << "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
)
{
UList<T> helper(const_cast<T*>(DL.begin()), DL.nextFree_);
UList<T> helper(DL.dataPtr_, DL.nextFree_);
os << helper;
return os;
@ -75,8 +72,10 @@ Foam::Istream& Foam::operator>>
"(Foam::Istream& is, Foam::DynList<T, staticSize>& DL)"
) << "Not implemented" << exit(FatalError);
is >> static_cast<List<T>&>(DL);
DL.nextFree_ = DL.List<T>::size();
UList<T> helper(DL.dataPtr_, DL.nextFree_);
//is >> static_cast<List<T>&>(DL);
is >> helper;
DL.nextFree_ = helper.size();
return is;
}

View file

@ -73,10 +73,14 @@ Istream& operator>>
template<class T, label staticSize = 16>
class DynList
:
public UList<T>
{
// Private data
//- pointer to the data
T* dataPtr_;
//- size of the allocated data
label nAllocated_;
//- statically allocated data (used for short lists)
T staticData_[staticSize];
@ -84,12 +88,21 @@ class DynList
label nextFree_;
// 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
inline void allocateSize(const label);
//- check if index is inside the scope (used for debugging only)
inline void checkIndex(const label) const;
//- check if nAllocated_ is greater or equal to nextFree_
inline void checkAllocation() const;
public:
// Constructors
@ -100,6 +113,11 @@ public:
//- Construct given size
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
explicit inline DynList(const label, const T&);
@ -205,6 +223,10 @@ public:
template<class 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

View file

@ -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>
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)
newData[i] = this->operator[](i);
for(label i=0;i<nextFree_;++i)
newData[i] = this->operator[](i);
T* data = UList<T>::begin();
if( data && (data != staticData_) )
delete [] data;
if( nAllocated_ > staticSize )
delete [] dataPtr_;
//UList<T>::reset(newData, s);
this->UList<T>::operator=(UList<T>(newData, s));
dataPtr_ = newData;
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)
newData[i] = this->operator[](i);
delete [] dataPtr_;
}
T* data = UList<T>::begin();
delete [] data;
//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));
dataPtr_ = staticData_;
nAllocated_ = 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 * * * * * * * * * * * * * * //
//- Construct null
template<class T, Foam::label staticSize>
inline Foam::DynList<T, staticSize>::DynList()
:
UList<T>(staticData_, staticSize),
dataPtr_(nullptr),
nAllocated_(0),
staticData_(),
nextFree_(0)
{}
{
setSize(0);
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
inline Foam::DynList<T, staticSize>::DynList(const label s)
:
UList<T>(staticData_, staticSize),
dataPtr_(nullptr),
nAllocated_(0),
staticData_(),
nextFree_(0)
{
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>
inline Foam::DynList<T, staticSize>::DynList(const label s, const T& val)
:
UList<T>(staticData_, staticSize),
dataPtr_(nullptr),
nAllocated_(0),
staticData_(),
nextFree_(0)
{
setSize(s);
for(label i=0;i<s;++i)
this->operator[](i) = val;
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
inline Foam::DynList<T, staticSize>::DynList(const UList<T>& ul)
:
UList<T>(staticData_, staticSize),
dataPtr_(nullptr),
nAllocated_(0),
staticData_(),
nextFree_(0)
{
setSize(ul.size());
forAll(ul, i)
this->operator[](i) = ul[i];
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
template<class ListType>
inline Foam::DynList<T, staticSize>::DynList(const ListType& l)
:
UList<T>(staticData_, staticSize),
dataPtr_(nullptr),
nAllocated_(0),
staticData_(),
nextFree_(0)
{
setSize(l.size());
for(label i=0;i<nextFree_;++i)
this->operator[](i) = l[i];
# ifdef DEBUG
checkAllocation();
# endif
}
//- Copy construct
@ -145,19 +227,24 @@ inline Foam::DynList<T, staticSize>::DynList
const DynList<T, staticSize>& dl
)
:
UList<T>(staticData_, staticSize),
dataPtr_(nullptr),
nAllocated_(0),
staticData_(),
nextFree_(0)
{
setSize(dl.size());
for(label i=0;i<nextFree_;++i)
this->operator[](i) = dl[i];
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
inline Foam::DynList<T, staticSize>::~DynList()
{
allocateSize(0);
//UList<T>::reset(nullptr, 0);
}
@ -166,12 +253,20 @@ inline Foam::DynList<T, staticSize>::~DynList()
template<class T, Foam::label staticSize>
inline Foam::label Foam::DynList<T, staticSize>::size() const
{
# ifdef DEBUG
checkAllocation();
# endif
return nextFree_;
}
template<class T, Foam::label staticSize>
inline Foam::label Foam::DynList<T, staticSize>::byteSize() const
{
# ifdef DEBUG
checkAllocation();
# endif
if( !contiguous<T>() )
{
FatalErrorIn("DynList<T>::byteSize()")
@ -181,20 +276,31 @@ inline Foam::label Foam::DynList<T, staticSize>::byteSize() const
}
return nextFree_*sizeof(T);
}
template<class T, Foam::label staticSize>
inline void Foam::DynList<T, staticSize>::setSize(const label s)
{
# ifdef DEBUG
checkAllocation();
# endif
allocateSize(s);
nextFree_ = s;
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
inline void Foam::DynList<T, staticSize>::clear()
{
# ifdef DEBUG
checkAllocation();
# endif
nextFree_ = 0;
}
@ -202,34 +308,62 @@ inline void Foam::DynList<T, staticSize>::clear()
template<class T, Foam::label staticSize>
void Foam::DynList<T, staticSize>::shrink()
{
# ifdef DEBUG
checkAllocation();
# endif
allocateSize(nextFree_);
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
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);
}
UList<T>::operator[](nextFree_++) = e;
# ifdef DEBUG
checkAllocation();
# endif
this->operator[](nextFree_++) = e;
}
template<class T, Foam::label staticSize>
inline void Foam::DynList<T, staticSize>::appendIfNotIn(const T& e)
{
# ifdef DEBUG
checkAllocation();
# endif
if( !contains(e) )
append(e);
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
inline bool Foam::DynList<T, staticSize>::contains(const T& e) const
{
# ifdef DEBUG
checkAllocation();
# endif
for(label i=0;i<nextFree_;++i)
{
if( UList<T>::operator[](i) == e )
if( this->operator[](i) == e )
return true;
}
@ -242,9 +376,13 @@ inline Foam::label Foam::DynList<T, staticSize>::containsAtPosition
const T& e
) const
{
# ifdef DEBUG
checkAllocation();
# endif
for(label i=0;i<nextFree_;++i)
{
if( UList<T>::operator[](i) == e )
if( this->operator[](i) == e )
return i;
}
@ -254,12 +392,20 @@ inline Foam::label Foam::DynList<T, staticSize>::containsAtPosition
template<class T, Foam::label staticSize>
inline const T& Foam::DynList<T, staticSize>::lastElement() const
{
# ifdef DEBUG
checkAllocation();
# endif
return this->operator[](nextFree_-1);
}
template<class T, Foam::label staticSize>
inline T Foam::DynList<T, staticSize>::removeLastElement()
{
# ifdef DEBUG
checkAllocation();
# endif
if( nextFree_ == 0 )
{
FatalErrorIn
@ -268,13 +414,18 @@ inline T Foam::DynList<T, staticSize>::removeLastElement()
) << "List is empty" << abort(FatalError);
}
T el = UList<T>::operator[](--nextFree_);
T el = this->operator[](nextFree_-1);
--nextFree_;
return el;
}
template<class T, Foam::label staticSize>
inline T Foam::DynList<T, staticSize>::removeElement(const label i)
{
# ifdef DEBUG
checkAllocation();
# endif
if( nextFree_ == 0 )
{
FatalErrorIn
@ -287,12 +438,20 @@ inline T Foam::DynList<T, staticSize>::removeElement(const label i)
this->operator[](i) = this->operator[](nextFree_-1);
--nextFree_;
# ifdef DEBUG
checkAllocation();
# endif
return el;
}
template<class T, Foam::label staticSize>
inline T& Foam::DynList<T, staticSize>::newElmt(const label i)
{
# ifdef DEBUG
checkAllocation();
# endif
return this->operator()(i);
}
@ -301,13 +460,21 @@ inline T& Foam::DynList<T, staticSize>::newElmt(const label i)
template<class T, Foam::label staticSize>
inline T& Foam::DynList<T, staticSize>::operator()(const label i)
{
# ifdef DEBUG
checkAllocation();
# endif
nextFree_ = Foam::max(nextFree_, i + 1);
if( nextFree_ >= UList<T>::size() )
if( nextFree_ >= nAllocated_ )
{
allocateSize(2 * nextFree_+1);
}
# ifdef DEBUG
checkAllocation();
# endif
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
{
# ifdef FULLDEBUG
checkAllocation();
checkIndex(i);
# endif
return UList<T>::operator[](i);
return dataPtr_[i];
}
template<class T, Foam::label staticSize>
inline T& Foam::DynList<T, staticSize>::operator[](const label i)
{
# ifdef FULLDEBUG
checkAllocation();
checkIndex(i);
# endif
return UList<T>::operator[](i);
return dataPtr_[i];
}
template<class T, Foam::label staticSize>
@ -374,7 +543,12 @@ inline const T& Foam::DynList<T, staticSize>::rcElement
template<class T, Foam::label staticSize>
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>
@ -383,9 +557,17 @@ inline void Foam::DynList<T, staticSize>::operator=
const DynList<T, staticSize>& dl
)
{
# ifdef DEBUG
checkAllocation();
# endif
allocateSize(dl.size());
nextFree_ = dl.size();
# ifdef DEBUG
checkAllocation();
# endif
for(label i=0;i<nextFree_;++i)
this->operator[](i) = dl[i];
}
@ -394,12 +576,45 @@ template<class T, Foam::label staticSize>
template<class ListType>
inline void Foam::DynList<T, staticSize>::operator=(const ListType& l)
{
# ifdef DEBUG
checkAllocation();
# endif
allocateSize(l.size());
nextFree_ = l.size();
# ifdef DEBUG
checkAllocation();
# endif
for(label i=0;i<nextFree_;++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);
}
// ************************************************************************* //

View file

@ -34,15 +34,34 @@ Foam::Ostream& Foam::operator<<
const Foam::FRWGraph<T, width>& DL
)
{
os << DL.size() << "(" << endl;
for(register label i=0;i<DL.size();++i)
os << DL.size() << "(" << nl;
for(label i=0;i<DL.size();++i)
{
os << width << "(";
for(label j=0;j<width;++j)
os << DL(i, j) << " " << endl;
os << ")" << endl;
{
if( j )
{
os << " ";
}
os << DL(i, j);
}
os << ")" << nl;
}
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;
}

View file

@ -105,7 +105,7 @@ inline Foam::label Foam::FRWGraph<T,width>::size() const
}
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;
}
@ -155,7 +155,8 @@ inline bool Foam::FRWGraph<T,width>::contains
) const
{
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 )
return true;
@ -170,7 +171,8 @@ inline Foam::label Foam::FRWGraph<T,width>::containsAtPosition
) const
{
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 )
return i;

View file

@ -46,7 +46,6 @@ IODynList<T, IndexType>::IODynList(const IOobject& io)
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|| (io.readOpt() == IOobject::READ_IF_PRESENT_IF_MODIFIED && headerOk())
)
{
readStream(typeName) >> *this;
@ -77,16 +76,12 @@ IODynList<T, IndexType>::IODynList
regIOobject(io),
DynList<T, IndexType>()
{
if
(
(io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|| (io.readOpt() == IOobject::READ_IF_PRESENT_IF_MODIFIED && headerOk())
)
if (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
{
readStream(typeName) >> *this;
close();
}
DynList<T, IndexType>::operator=(list);
}

View file

@ -46,7 +46,6 @@ IOLongList<T, Offset>::IOLongList(const IOobject& io)
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|| (io.readOpt() == IOobject::READ_IF_PRESENT_IF_MODIFIED && headerOk())
)
{
readStream(typeName) >> *this;
@ -77,16 +76,12 @@ IOLongList<T, Offset>::IOLongList
regIOobject(io),
LongList<T, Offset>()
{
if
(
(io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|| (io.readOpt() == IOobject::READ_IF_PRESENT_IF_MODIFIED && headerOk())
)
if (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
{
readStream(typeName) >> *this;
close();
}
LongList<T, Offset>::operator=(list);
}

View file

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

View file

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

View file

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

View file

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

View file

@ -202,7 +202,7 @@ Foam::Istream& Foam::operator>>
if( listDelimiter == token::BEGIN_LIST )
{
for(register label i=0;i<size;++i)
for(label i=0;i<size;++i)
{
is >> DL[i];
@ -223,7 +223,7 @@ Foam::Istream& Foam::operator>>
"reading the single entry"
);
for(register label i=0;i<size;++i)
for(label i=0;i<size;++i)
{
DL[i] = element;
}
@ -306,7 +306,7 @@ void Foam::LongList<T, Offset>::appendFromStream(Istream& is)
if( listDelimiter == token::BEGIN_LIST )
{
for(register label i=0;i<size;++i)
for(label i=0;i<size;++i)
{
is >> this->operator[](origSize);
++origSize;
@ -328,7 +328,7 @@ void Foam::LongList<T, Offset>::appendFromStream(Istream& is)
"reading the single entry"
);
for(register label i=0;i<size;++i)
for(label i=0;i<size;++i)
{
this->operator[](origSize) = element;
++origSize;
@ -346,31 +346,6 @@ void Foam::LongList<T, Offset>::appendFromStream(Istream& is)
forAll(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
(
"appendFromStream(Istream& is)"

View file

@ -78,7 +78,7 @@ inline void Foam::LongList<T, Offset>::allocateSize(const label s)
if( numblock1 < numBlocks_ )
{
for(register label i=numblock1;i<numBlocks_;++i)
for(label i=numblock1;i<numBlocks_;++i)
delete [] dataPtr_[i];
}
else if( numblock1 > numBlocks_ )
@ -91,7 +91,8 @@ inline void Foam::LongList<T, Offset>::allocateSize(const label s)
} while( numblock1 > 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];
if( dataPtr_ )
@ -99,7 +100,7 @@ inline void Foam::LongList<T, Offset>::allocateSize(const label s)
dataPtr_ = dataptr1;
}
for(register label i=numBlocks_;i<numblock1;++i)
for(label i=numBlocks_;i<numblock1;++i)
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>
void Foam::LongList<T, Offset>::clearOut()
{
for(register label i=0;i<numBlocks_;++i)
for(label i=0;i<numBlocks_;++i)
delete [] dataPtr_[i];
if( dataPtr_ )
@ -281,7 +282,7 @@ inline void Foam::LongList<T, Offset>::appendIfNotIn(const T& e)
template<class T, Foam::label Offset>
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 )
return true;
@ -294,7 +295,7 @@ inline Foam::label Foam::LongList<T, Offset>::containsAtPosition
const T& e
) const
{
for(register label i=0;i<nextFree_;++i)
for(label i=0;i<nextFree_;++i)
if( (*this)[i] == e )
return i;
@ -376,7 +377,7 @@ inline T& Foam::LongList<T, Offset>::newElmt(const label i)
template<class T, Foam::label Offset>
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;
}
@ -384,7 +385,8 @@ template<class T, Foam::label Offset>
inline void Foam::LongList<T, Offset>::operator=(const LongList<T, Offset>& l)
{
setSize(l.size());
for(register label i=0;i<l.nextFree_;++i)
for(label i=0;i<l.nextFree_;++i)
operator[](i) = l[i];
}

View file

@ -35,22 +35,29 @@ Foam::Ostream& Foam::operator<<
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)
{
if( j > 0 ) os << token::SPACE;
if( j ) os << token::SPACE;
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;
}

View file

@ -48,6 +48,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
class VRWGraphModifier;
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
\*---------------------------------------------------------------------------*/

View file

@ -518,7 +518,7 @@ inline bool Foam::VRWGraph::contains
return false;
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 )
return true;
@ -536,7 +536,8 @@ inline Foam::label Foam::VRWGraph::containsAtPosition
return -1;
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 )
return i;

View file

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

View file

@ -37,12 +37,20 @@ Foam::Ostream& Foam::operator<<
{
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 << token::END_LIST;
// Check state of IOstream
os.check
(
"Foam::Ostream& Foam::operator<<"
"(Foam::Ostream&, const Foam::VRWGraphList&)"
);
return os;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -26,8 +26,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGen.H"
#include "meshSurfaceEngine.H"
#include "OFstream.H"

View file

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

View file

@ -117,7 +117,7 @@ void decomposeCells::checkFaceConnections(const boolList& decomposeCell)
OPstream toOtherProc
(
Pstream::blocking,
Pstream::commsTypes::blocking,
procBoundaries[patchI].neiProcNo(),
decFace.byteSize()
);
@ -132,7 +132,7 @@ void decomposeCells::checkFaceConnections(const boolList& decomposeCell)
IPstream fromOtherProc
(
Pstream::blocking,
Pstream::commsTypes::blocking,
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_);
const faceList::subList& bFaces = mse.boundaryFaces();

View file

@ -23,7 +23,7 @@ License
Description
\*----------------------p-----------------------------------------------------*/
\*---------------------------------------------------------------------------*/
#include "decomposeCells.H"
#include "helperFunctions.H"
@ -55,8 +55,10 @@ void decomposeCells::findAddressingForCell
const faceListPMG& faces = mesh_.faces();
forAll(faceEdges, feI)
{
faceEdges[feI].setSize(faces[c[feI]].size());
faceEdges[feI] = -1;
DynList<label, 8>& fEdges = faceEdges[feI];
fEdges.setSize(faces[c[feI]].size());
fEdges = label(-1);
}
forAll(c, fI)
@ -127,9 +129,9 @@ void decomposeCells::findAddressingForCell
label decomposeCells::findTopVertex
(
const label cellI,
const DynList<label, 32>& vrt,
const DynList<edge, 64>& edges,
const DynList<DynList<label, 2>, 64>& edgeFaces
const DynList<label, 32>& /*vrt*/,
const DynList<edge, 64>& /*edges*/,
const DynList<DynList<label, 2>, 64>& /*edgeFaces*/
)
{
const cell& c = mesh_.cells()[cellI];

View file

@ -370,7 +370,7 @@ void decomposeFaces::decomposeConcaveInternalFaces
# endif
//- decompose internal faces
for(register label faceI=0;faceI<nIntFaces;++faceI)
for(label faceI=0;faceI<nIntFaces;++faceI)
{
const face& f = faces[faceI];

View file

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

View file

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

View file

@ -26,6 +26,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "quadricFitting.H"
#include "helperFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,11 +49,15 @@ void quadricFitting::calculateNormalVector()
mat /= otherPoints_.size();
//- find the eigenvalues of the tensor
const vector ev = eigenValues(mat);
const vector ev = help::eigenValues(mat);
//- estimate the normal as the eigenvector associated
//- 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()

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -99,12 +99,10 @@ class parTriFace
// Member operators
inline bool operator !=(const parTriFace& ptf) const
inline bool operator !=(const parTriFace& /*ptf*/) const
{
Serr << "parTriFace::operator!= Not implemented" << endl;
::exit(1);
return true;
}
// Friend operators

View file

@ -50,7 +50,7 @@ void sortEdgesIntoChains::createNodeLabels()
newNodeLabel_.insert(e.end(), nPoints++);
}
edgesAtPoint_.setSize(nPoints, DynList<label>());
edgesAtPoint_.setSize(nPoints);
forAll(bEdges_, eI)
{
const edge& e = bEdges_[eI];
@ -69,7 +69,7 @@ void sortEdgesIntoChains::createNodeLabels()
bool sortEdgesIntoChains::findPointsBelongingToTheChain
(
const label currPos,
boolList& chainEdges
DynList<bool>& chainEdges
) const
{
# ifdef DEBUGSort
@ -150,7 +150,7 @@ bool sortEdgesIntoChains::findPointsBelongingToTheChain
return true;
}
void sortEdgesIntoChains::shrinkEdges(const boolList& chainEdges)
void sortEdgesIntoChains::shrinkEdges(const DynList<bool>& chainEdges)
{
forAll(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)
if( chainEdges[eI] )
++i;
labelList chainPoints(i);
DynList<label> chainPoints(i);
i = 0;
forAll(chainEdges, eI)
@ -232,7 +232,7 @@ void sortEdgesIntoChains::sortEdges()
if( !openEdges_ )
{
boolList chainEdges(bEdges_.size());
DynList<bool> chainEdges(bEdges_.size());
forAll(edgesAtPoint_, pI)
if( findPointsBelongingToTheChain(pI, chainEdges) )
{
@ -257,12 +257,11 @@ sortEdgesIntoChains::sortEdgesIntoChains(const DynList<edge>& bEdges)
}
sortEdgesIntoChains::~sortEdgesIntoChains()
{
}
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
// Member functions
const DynList<labelList>& sortEdgesIntoChains::sortedChains() const
const DynList<DynList<label> >& sortEdgesIntoChains::sortedChains() const
{
return createdChains_;
}

View file

@ -39,7 +39,6 @@ SourceFiles
#include "labelList.H"
#include "edge.H"
#include "Map.H"
#include "boolList.H"
namespace Foam
{
@ -57,9 +56,9 @@ class sortEdgesIntoChains
Map<label> newNodeLabel_;
List<DynList<label> > edgesAtPoint_;
DynList<DynList<label> > edgesAtPoint_;
DynList<labelList> createdChains_;
DynList<DynList<label> > createdChains_;
// Private member functions
void createNodeLabels();
@ -67,12 +66,12 @@ class sortEdgesIntoChains
bool findPointsBelongingToTheChain
(
const label currPos,
boolList& chainEdges
DynList<bool>& chainEdges
) 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();
@ -88,7 +87,7 @@ class sortEdgesIntoChains
// Member functions
//- a list of points which have not yet been resolved
const DynList<labelList>& sortedChains() const;
const DynList<DynList<label> >& sortedChains() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -316,7 +316,7 @@ label groupMarking
//- ones into a new group
DynList<label> globalGroupLabel;
globalGroupLabel.setSize(nGroups);
globalGroupLabel = -1;
globalGroupLabel = label(-1);
//- reduce the information about the groups
label counter(0);

View file

@ -65,6 +65,12 @@ namespace help
template<class 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
template<class Face1, class Face2>
inline bool isSharedEdgeConvex
@ -289,6 +295,9 @@ namespace help
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
inline bool isVertexVisible(const point& p, const plane& pl);

View file

@ -69,6 +69,168 @@ bool isinf(const ListType& l)
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>
inline bool isSharedEdgeConvex
(
@ -1056,7 +1218,7 @@ inline bool doTrianglesOverlap
x /= (mag(x) + VSMALL);
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[1] = point2D((tri0.b() - origin) & x, (tri0.b() - origin) & y);
poly2D[2] = point2D((tri0.c() - origin) & x, (tri0.c() - origin) & y);
@ -1612,6 +1774,17 @@ inline bool isFaceConvexAndOk
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
(
const point& edgePoint0,

View file

@ -79,7 +79,7 @@ void whisperReduce(const ListType& neis, const scatterOp& sop, gatherOp& gop)
{
//- receive the data
List<T> receivedData;
IPstream fromOtherProc(Pstream::blocking, above[aboveI]);
IPstream fromOtherProc(Pstream::commsTypes::blocking, above[aboveI]);
fromOtherProc >> receivedData;
gop(receivedData);
@ -94,7 +94,13 @@ void whisperReduce(const ListType& neis, const scatterOp& sop, gatherOp& gop)
sop(dts);
//- send the data
OPstream toOtherProc(Pstream::blocking, neiProc, dts.byteSize());
OPstream toOtherProc
(
Pstream::commsTypes::blocking,
neiProc,
dts.byteSize()
);
toOtherProc << dts;
}
@ -104,7 +110,7 @@ void whisperReduce(const ListType& neis, const scatterOp& sop, gatherOp& gop)
{
//- receive the data
List<T> receivedData;
IPstream fromOtherProc(Pstream::blocking, below[belowI]);
IPstream fromOtherProc(Pstream::commsTypes::blocking, below[belowI]);
fromOtherProc >> receivedData;
gop(receivedData);
@ -119,7 +125,13 @@ void whisperReduce(const ListType& neis, const scatterOp& sop, gatherOp& gop)
sop(dts);
//- send the data
OPstream toOtherProc(Pstream::blocking, neiProc, dts.byteSize());
OPstream toOtherProc
(
Pstream::commsTypes::blocking,
neiProc,
dts.byteSize()
);
toOtherProc << dts;
}
}
@ -143,14 +155,24 @@ void exchangeMap
labelHashSet receiveData;
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();
}
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;
fromOtherProc >> s;
@ -159,7 +181,7 @@ void exchangeMap
receiveData.insert(iter->first);
}
if( commsType == Pstream::blocking )
if( commsType == Pstream::commsTypes::blocking )
{
//- start with blocking type of send and received operation
@ -173,7 +195,7 @@ void exchangeMap
OPstream toOtherProc
(
Pstream::blocking,
Pstream::commsTypes::blocking,
iter->first,
dts.byteSize()
);
@ -186,11 +208,16 @@ void exchangeMap
if( !receiveData.found(iter->first) )
continue;
IPstream fromOtherProc(Pstream::blocking, iter->first);
IPstream fromOtherProc
(
Pstream::commsTypes::blocking,
iter->first
);
data.appendFromStream(fromOtherProc);
}
}
else if( commsType == Pstream::scheduled )
else if( commsType == Pstream::commsTypes::scheduled )
{
//- start with scheduled data transfer
//- this type of transfer is intended for long messages because
@ -204,13 +231,13 @@ void exchangeMap
if( !receiveData.found(iter->first) )
continue;
//List<T> receive;
IPstream fromOtherProc(Pstream::scheduled, iter->first);
//fromOtherProc >> receive;
data.appendFromStream(fromOtherProc);
IPstream fromOtherProc
(
Pstream::commsTypes::scheduled,
iter->first
);
//forAll(receive, i)
// data.append(receive[i]);
data.appendFromStream(fromOtherProc);
}
//- send data to processors with greater ids
@ -226,7 +253,7 @@ void exchangeMap
OPstream toOtherProc
(
Pstream::scheduled,
Pstream::commsTypes::scheduled,
iter->first,
dts.byteSize()
);
@ -243,13 +270,13 @@ void exchangeMap
if( !receiveData.found(riter->first) )
continue;
IPstream fromOtherProc(Pstream::scheduled, riter->first);
//List<T> receive;
//fromOtherProc >> receive;
data.appendFromStream(fromOtherProc);
IPstream fromOtherProc
(
Pstream::commsTypes::scheduled,
riter->first
);
//forAll(receive, i)
// data.append(receive[i]);
data.appendFromStream(fromOtherProc);
}
//- send data to processors with lower ids
@ -265,7 +292,7 @@ void exchangeMap
OPstream toOtherProc
(
Pstream::scheduled,
Pstream::commsTypes::scheduled,
riter->first,
dts.byteSize()
);
@ -317,7 +344,7 @@ void exchangeMap
OPstream toOtherProc
(
Pstream::blocking,
Pstream::commsTypes::blocking,
iter->first,
dataToSend.byteSize()
);
@ -330,7 +357,12 @@ void exchangeMap
mOut.insert(std::make_pair(iter->first, List<T>()));
List<T>& dataToReceive = mOut[iter->first];
IPstream fromOtherProc(Pstream::blocking, iter->first);
IPstream fromOtherProc
(
Pstream::commsTypes::blocking,
iter->first
);
fromOtherProc >> dataToReceive;
}
}

View file

@ -65,7 +65,7 @@ void exchangeMap
(
const std::map<label, ListType>&,
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

View file

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

View file

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

View file

@ -488,7 +488,7 @@ inline void zipOpenChain(DynList<edge>& bEdges)
}
bool closed(true);
DynList<label> openVertices(2);
DynList<label> openVertices(label(2));
forAll(chainVertices, pI)
if( nAppearances[pI] == 1 )
{

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