mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
This commit is contained in:
@ -81,6 +81,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
Pout<< "zero scalar (time): " << dimensionedScalar(dimTime) << endl;
|
||||
Pout<< "zero vector: " << dimensionedVector(dimLength) << endl;
|
||||
Pout<< "zero tensor: " << dimensionedTensor(dimLength) << endl;
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
@ -55,6 +55,7 @@ Usage
|
||||
#include "triangle.H"
|
||||
#include "triSurface.H"
|
||||
#include "triSurfaceSearch.H"
|
||||
#include "triSurfaceTools.H"
|
||||
#include "argList.H"
|
||||
#include "OFstream.H"
|
||||
#include "OBJstream.H"
|
||||
@ -64,79 +65,6 @@ Usage
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// Does face use valid vertices?
|
||||
bool validTri
|
||||
(
|
||||
const bool verbose,
|
||||
const triSurface& surf,
|
||||
const label facei
|
||||
)
|
||||
{
|
||||
// Simple check on indices ok.
|
||||
|
||||
const labelledTri& f = surf[facei];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (f[fp] < 0 || f[fp] >= surf.points().size())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei << " vertices " << f
|
||||
<< " uses point indices outside point range 0.."
|
||||
<< surf.points().size()-1 << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((f[0] == f[1]) || (f[0] == f[2]) || (f[1] == f[2]))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei
|
||||
<< " uses non-unique vertices " << f
|
||||
<< " coords:" << f.points(surf.points())
|
||||
<< endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// duplicate triangle check
|
||||
|
||||
const labelList& fFaces = surf.faceFaces()[facei];
|
||||
|
||||
// Check if faceNeighbours use same points as this face.
|
||||
// Note: discards normal information - sides of baffle are merged.
|
||||
forAll(fFaces, i)
|
||||
{
|
||||
label nbrFacei = fFaces[i];
|
||||
|
||||
if (nbrFacei <= facei)
|
||||
{
|
||||
// lower numbered faces already checked
|
||||
continue;
|
||||
}
|
||||
|
||||
const labelledTri& nbrF = surf[nbrFacei];
|
||||
|
||||
if
|
||||
(
|
||||
((f[0] == nbrF[0]) || (f[0] == nbrF[1]) || (f[0] == nbrF[2]))
|
||||
&& ((f[1] == nbrF[0]) || (f[1] == nbrF[1]) || (f[1] == nbrF[2]))
|
||||
&& ((f[2] == nbrF[0]) || (f[2] == nbrF[1]) || (f[2] == nbrF[2]))
|
||||
)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei << " vertices " << f
|
||||
<< " has the same vertices as triangle " << nbrFacei
|
||||
<< " vertices " << nbrF
|
||||
<< " coords:" << f.points(surf.points())
|
||||
<< endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
labelList countBins
|
||||
(
|
||||
const scalar min,
|
||||
@ -377,14 +305,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
const fileName surfFileName = args[1];
|
||||
const bool checkSelfIntersect = args.optionFound("checkSelfIntersection");
|
||||
const bool verbose = args.optionFound("verbose");
|
||||
const bool splitNonManifold = args.optionFound("splitNonManifold");
|
||||
label outputThreshold = 10;
|
||||
args.optionReadIfPresent("outputThreshold", outputThreshold);
|
||||
|
||||
Info<< "Reading surface from " << surfFileName << " ..." << nl << endl;
|
||||
|
||||
|
||||
// Read
|
||||
// ~~~~
|
||||
|
||||
@ -479,7 +405,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(surf, facei)
|
||||
{
|
||||
if (!validTri(verbose, surf, facei))
|
||||
if (!triSurfaceTools::validTri(surf, facei))
|
||||
{
|
||||
illegalFaces.append(facei);
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ int main(int argc, char *argv[])
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noClean",
|
||||
"perform some surface checking/cleanup on the input surface"
|
||||
"suppress surface checking/cleanup on the input surface"
|
||||
);
|
||||
argList args(argc, argv);
|
||||
|
||||
|
||||
@ -91,7 +91,11 @@ int main(int argc, char *argv[])
|
||||
argList::validArgs.append("inputFile");
|
||||
argList::validArgs.append("outputFile");
|
||||
|
||||
argList::addBoolOption("clean");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"clean",
|
||||
"perform some surface checking/cleanup on the input surface"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"orient",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -169,6 +169,18 @@ Foam::dimensioned<Type>::dimensioned
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::dimensioned<Type>::dimensioned
|
||||
(
|
||||
const dimensionSet& dimSet
|
||||
)
|
||||
:
|
||||
name_("0"),
|
||||
dimensions_(dimSet),
|
||||
value_(Zero)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -117,9 +117,12 @@ public:
|
||||
//- Construct from dictionary lookup with a given name and dimensions
|
||||
dimensioned(const word&, const dimensionSet&, const dictionary&);
|
||||
|
||||
//- Null constructor
|
||||
//- Null constructor - a dimensionless Zero, named "undefined"
|
||||
dimensioned();
|
||||
|
||||
//- A dimensioned Zero, named "0"
|
||||
explicit dimensioned(const dimensionSet&);
|
||||
|
||||
|
||||
// Static member functions
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ Foam::surfZoneIdentifier::surfZoneIdentifier()
|
||||
{}
|
||||
|
||||
|
||||
Foam::surfZoneIdentifier::surfZoneIdentifier(label index)
|
||||
Foam::surfZoneIdentifier::surfZoneIdentifier(const label index)
|
||||
:
|
||||
name_(),
|
||||
index_(index),
|
||||
|
||||
@ -86,10 +86,7 @@ public:
|
||||
surfZoneIdentifier();
|
||||
|
||||
//- Construct null with specified index
|
||||
explicit surfZoneIdentifier
|
||||
(
|
||||
const label index
|
||||
);
|
||||
explicit surfZoneIdentifier(const label index);
|
||||
|
||||
//- Construct from components
|
||||
surfZoneIdentifier
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "triSurfaceTools.H"
|
||||
|
||||
#include "triSurface.H"
|
||||
#include "MeshedSurface.H"
|
||||
#include "OFstream.H"
|
||||
#include "mergePoints.H"
|
||||
#include "polyMesh.H"
|
||||
@ -2743,8 +2744,168 @@ void Foam::triSurfaceTools::calcInterpolationWeights
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Tracking:
|
||||
// Checking:
|
||||
|
||||
bool Foam::triSurfaceTools::validTri
|
||||
(
|
||||
const triSurface& surf,
|
||||
const label facei
|
||||
)
|
||||
{
|
||||
typedef labelledTri FaceType;
|
||||
const FaceType& f = surf[facei];
|
||||
|
||||
// Simple check on indices ok.
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (f[fp] < 0 || f[fp] >= surf.points().size())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei << " vertices " << f
|
||||
<< " uses point indices outside point range 0.."
|
||||
<< surf.points().size()-1
|
||||
<< endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (f[0] == f[1] || f[0] == f[2] || f[1] == f[2])
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei
|
||||
<< " uses non-unique vertices " << f
|
||||
<< " coords:" << f.points(surf.points())
|
||||
<< endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// duplicate triangle check
|
||||
|
||||
const labelList& fFaces = surf.faceFaces()[facei];
|
||||
|
||||
// Check if faceNeighbours use same points as this face.
|
||||
// Note: discards normal information - sides of baffle are merged.
|
||||
forAll(fFaces, i)
|
||||
{
|
||||
label nbrFacei = fFaces[i];
|
||||
|
||||
if (nbrFacei <= facei)
|
||||
{
|
||||
// lower numbered faces already checked
|
||||
continue;
|
||||
}
|
||||
|
||||
const FaceType& nbrF = surf[nbrFacei];
|
||||
|
||||
// Same as calling triFace::compare(f, nbrF) == 1 only
|
||||
if
|
||||
(
|
||||
(f[0] == nbrF[0] || f[0] == nbrF[1] || f[0] == nbrF[2])
|
||||
&& (f[1] == nbrF[0] || f[1] == nbrF[1] || f[1] == nbrF[2])
|
||||
&& (f[2] == nbrF[0] || f[2] == nbrF[1] || f[2] == nbrF[2])
|
||||
)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei << " vertices " << f
|
||||
<< " has the same vertices as triangle " << nbrFacei
|
||||
<< " vertices " << nbrF
|
||||
<< " coords:" << f.points(surf.points())
|
||||
<< endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::triSurfaceTools::validTri
|
||||
(
|
||||
const MeshedSurface<face>& surf,
|
||||
const label facei
|
||||
)
|
||||
{
|
||||
typedef face FaceType;
|
||||
const FaceType& f = surf[facei];
|
||||
|
||||
if (f.size() != 3)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "face " << facei
|
||||
<< " is not a triangle, it has " << f.size()
|
||||
<< " indices"
|
||||
<< endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Simple check on indices ok.
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (f[fp] < 0 || f[fp] >= surf.points().size())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei << " vertices " << f
|
||||
<< " uses point indices outside point range 0.."
|
||||
<< surf.points().size()-1
|
||||
<< endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (f[0] == f[1] || f[0] == f[2] || f[1] == f[2])
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei
|
||||
<< " uses non-unique vertices " << f
|
||||
<< " coords:" << f.points(surf.points())
|
||||
<< endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// duplicate triangle check
|
||||
|
||||
const labelList& fFaces = surf.faceFaces()[facei];
|
||||
|
||||
// Check if faceNeighbours use same points as this face.
|
||||
// Note: discards normal information - sides of baffle are merged.
|
||||
forAll(fFaces, i)
|
||||
{
|
||||
label nbrFacei = fFaces[i];
|
||||
|
||||
if (nbrFacei <= facei)
|
||||
{
|
||||
// lower numbered faces already checked
|
||||
continue;
|
||||
}
|
||||
|
||||
const FaceType& nbrF = surf[nbrFacei];
|
||||
|
||||
// Same as calling triFace::compare(f, nbrF) == 1 only
|
||||
if
|
||||
(
|
||||
(f[0] == nbrF[0] || f[0] == nbrF[1] || f[0] == nbrF[2])
|
||||
&& (f[1] == nbrF[0] || f[1] == nbrF[1] || f[1] == nbrF[2])
|
||||
&& (f[2] == nbrF[0] || f[2] == nbrF[1] || f[2] == nbrF[2])
|
||||
)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei << " vertices " << f
|
||||
<< " has the same vertices as triangle " << nbrFacei
|
||||
<< " vertices " << nbrF
|
||||
<< " coords:" << f.points(surf.points())
|
||||
<< endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Tracking:
|
||||
|
||||
// Test point on surface to see if is on face,edge or point.
|
||||
Foam::surfaceLocation Foam::triSurfaceTools::classify
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -50,11 +50,14 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class triSurface;
|
||||
class edge;
|
||||
class labelledTri;
|
||||
class polyBoundaryMesh;
|
||||
class plane;
|
||||
class triSurface;
|
||||
class face;
|
||||
template<class Face> class MeshedSurface;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class triSurfaceTools Declaration
|
||||
@ -516,6 +519,15 @@ public:
|
||||
static triSurface delaunay2D(const List<vector2D>&);
|
||||
|
||||
|
||||
// Surface checking functionality
|
||||
|
||||
//- Check single triangle for (topological) validity
|
||||
static bool validTri(const triSurface&, const label facei);
|
||||
|
||||
//- Check single triangle for (topological) validity
|
||||
static bool validTri(const MeshedSurface<face>&, const label facei);
|
||||
|
||||
|
||||
// Tracking
|
||||
|
||||
//- Test point on plane of triangle to see if on edge or point or inside
|
||||
|
||||
@ -55,7 +55,7 @@ void Foam::cuttingPlane::calcCutCells
|
||||
listSize = cellIdLabels.size();
|
||||
}
|
||||
|
||||
cutCells_.setSize(listSize);
|
||||
meshCells_.setSize(listSize);
|
||||
label cutcelli(0);
|
||||
|
||||
// Find the cut cells by detecting any cell that uses points with
|
||||
@ -70,9 +70,7 @@ void Foam::cuttingPlane::calcCutCells
|
||||
}
|
||||
|
||||
const labelList& cEdges = cellEdges[celli];
|
||||
|
||||
label nCutEdges = 0;
|
||||
|
||||
forAll(cEdges, i)
|
||||
{
|
||||
const edge& e = edges[cEdges[i]];
|
||||
@ -87,8 +85,7 @@ void Foam::cuttingPlane::calcCutCells
|
||||
|
||||
if (nCutEdges > 2)
|
||||
{
|
||||
cutCells_[cutcelli++] = celli;
|
||||
|
||||
meshCells_[cutcelli++] = celli;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -96,7 +93,7 @@ void Foam::cuttingPlane::calcCutCells
|
||||
}
|
||||
|
||||
// Set correct list size
|
||||
cutCells_.setSize(cutcelli);
|
||||
meshCells_.setSize(cutcelli);
|
||||
}
|
||||
|
||||
|
||||
@ -114,7 +111,7 @@ void Foam::cuttingPlane::intersectEdges
|
||||
// Per edge -1 or the label of the intersection point
|
||||
edgePoint.setSize(edges.size());
|
||||
|
||||
DynamicList<point> dynCuttingPoints(4*cutCells_.size());
|
||||
DynamicList<point> dynCuttingPoints(4*meshCells_.size());
|
||||
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
@ -258,15 +255,15 @@ void Foam::cuttingPlane::walkCellCuts
|
||||
const pointField& cutPoints = this->points();
|
||||
|
||||
// use dynamic lists to handle triangulation and/or missed cuts
|
||||
DynamicList<face> dynCutFaces(cutCells_.size());
|
||||
DynamicList<label> dynCutCells(cutCells_.size());
|
||||
DynamicList<face> dynCutFaces(meshCells_.size());
|
||||
DynamicList<label> dynCutCells(meshCells_.size());
|
||||
|
||||
// scratch space for calculating the face vertices
|
||||
DynamicList<label> faceVerts(10);
|
||||
|
||||
forAll(cutCells_, i)
|
||||
forAll(meshCells_, i)
|
||||
{
|
||||
label celli = cutCells_[i];
|
||||
label celli = meshCells_[i];
|
||||
|
||||
// Find the starting edge to walk from.
|
||||
const labelList& cEdges = mesh.cellEdges()[celli];
|
||||
@ -330,20 +327,18 @@ void Foam::cuttingPlane::walkCellCuts
|
||||
}
|
||||
|
||||
this->storedFaces().transfer(dynCutFaces);
|
||||
cutCells_.transfer(dynCutCells);
|
||||
meshCells_.transfer(dynCutCells);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct without cutting
|
||||
Foam::cuttingPlane::cuttingPlane(const plane& pln)
|
||||
:
|
||||
plane(pln)
|
||||
{}
|
||||
|
||||
|
||||
// Construct from plane and mesh reference, restricted to a list of cells
|
||||
Foam::cuttingPlane::cuttingPlane
|
||||
(
|
||||
const plane& pln,
|
||||
@ -369,7 +364,7 @@ void Foam::cuttingPlane::reCut
|
||||
)
|
||||
{
|
||||
MeshStorage::clear();
|
||||
cutCells_.clear();
|
||||
meshCells_.clear();
|
||||
|
||||
const scalarField dotProducts((mesh.points() - refPoint()) & normal());
|
||||
|
||||
@ -391,7 +386,7 @@ void Foam::cuttingPlane::remapFaces
|
||||
const labelUList& faceMap
|
||||
)
|
||||
{
|
||||
// recalculate the cells cut
|
||||
// Recalculate the cells cut
|
||||
if (notNull(faceMap) && faceMap.size())
|
||||
{
|
||||
MeshStorage::remapFaces(faceMap);
|
||||
@ -399,9 +394,9 @@ void Foam::cuttingPlane::remapFaces
|
||||
List<label> newCutCells(faceMap.size());
|
||||
forAll(faceMap, facei)
|
||||
{
|
||||
newCutCells[facei] = cutCells_[faceMap[facei]];
|
||||
newCutCells[facei] = meshCells_[faceMap[facei]];
|
||||
}
|
||||
cutCells_.transfer(newCutCells);
|
||||
meshCells_.transfer(newCutCells);
|
||||
}
|
||||
}
|
||||
|
||||
@ -420,7 +415,7 @@ void Foam::cuttingPlane::operator=(const cuttingPlane& rhs)
|
||||
|
||||
static_cast<MeshStorage&>(*this) = rhs;
|
||||
static_cast<plane&>(*this) = rhs;
|
||||
cutCells_ = rhs.cutCells();
|
||||
meshCells_ = rhs.meshCells();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ class cuttingPlane
|
||||
// Private data
|
||||
|
||||
//- List of cells cut by the plane
|
||||
labelList cutCells_;
|
||||
labelList meshCells_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -121,7 +121,7 @@ protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Recut mesh with existing planeDesc, restricted to a list of cells
|
||||
//- Recut mesh with existing plane, restricted to a list of cells
|
||||
void reCut
|
||||
(
|
||||
const primitiveMesh&,
|
||||
@ -157,15 +157,15 @@ public:
|
||||
}
|
||||
|
||||
//- Return List of cells cut by the plane
|
||||
const labelList& cutCells() const
|
||||
const labelList& meshCells() const
|
||||
{
|
||||
return cutCells_;
|
||||
return meshCells_;
|
||||
}
|
||||
|
||||
//- Return true or false to question: have any cells been cut?
|
||||
bool cut() const
|
||||
{
|
||||
return cutCells_.size();
|
||||
return meshCells_.size();
|
||||
}
|
||||
|
||||
//- Sample the cell field
|
||||
|
||||
@ -28,8 +28,6 @@ Description
|
||||
|
||||
#include "cuttingPlane.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -38,7 +36,7 @@ Foam::tmp<Foam::Field<Type>> Foam::cuttingPlane::sample
|
||||
const Field<Type>& fld
|
||||
) const
|
||||
{
|
||||
return tmp<Field<Type>>(new Field<Type>(fld, cutCells()));
|
||||
return tmp<Field<Type>>(new Field<Type>(fld, meshCells()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ License
|
||||
#include "OFstream.H"
|
||||
#include "meshTools.H"
|
||||
#include "triSurfaceSearch.H"
|
||||
#include "triSurfaceTools.H"
|
||||
#include "surfaceIntersection.H"
|
||||
#include "intersectedSurface.H"
|
||||
#include "searchableBox.H"
|
||||
@ -1257,76 +1258,6 @@ void Foam::isoSurface::trimToBox
|
||||
}
|
||||
|
||||
|
||||
bool Foam::isoSurface::validTri(const triSurface& surf, const label facei)
|
||||
{
|
||||
// Simple check on indices ok.
|
||||
|
||||
const labelledTri& f = surf[facei];
|
||||
|
||||
if
|
||||
(
|
||||
(f[0] < 0) || (f[0] >= surf.points().size())
|
||||
|| (f[1] < 0) || (f[1] >= surf.points().size())
|
||||
|| (f[2] < 0) || (f[2] >= surf.points().size())
|
||||
)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei << " vertices " << f
|
||||
<< " uses point indices outside point range 0.."
|
||||
<< surf.points().size()-1 << endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((f[0] == f[1]) || (f[0] == f[2]) || (f[1] == f[2]))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei
|
||||
<< " uses non-unique vertices " << f
|
||||
<< endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// duplicate triangle check
|
||||
|
||||
const labelList& fFaces = surf.faceFaces()[facei];
|
||||
|
||||
// Check if faceNeighbours use same points as this face.
|
||||
// Note: discards normal information - sides of baffle are merged.
|
||||
forAll(fFaces, i)
|
||||
{
|
||||
label nbrFacei = fFaces[i];
|
||||
|
||||
if (nbrFacei <= facei)
|
||||
{
|
||||
// lower numbered faces already checked
|
||||
continue;
|
||||
}
|
||||
|
||||
const labelledTri& nbrF = surf[nbrFacei];
|
||||
|
||||
if
|
||||
(
|
||||
((f[0] == nbrF[0]) || (f[0] == nbrF[1]) || (f[0] == nbrF[2]))
|
||||
&& ((f[1] == nbrF[0]) || (f[1] == nbrF[1]) || (f[1] == nbrF[2]))
|
||||
&& ((f[2] == nbrF[0]) || (f[2] == nbrF[1]) || (f[2] == nbrF[2]))
|
||||
)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei << " vertices " << f
|
||||
<< " fc:" << f.centre(surf.points())
|
||||
<< " has the same vertices as triangle " << nbrFacei
|
||||
<< " vertices " << nbrF
|
||||
<< " fc:" << nbrF.centre(surf.points())
|
||||
<< endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Foam::triSurface Foam::isoSurface::subsetMesh
|
||||
(
|
||||
const triSurface& s,
|
||||
@ -1756,8 +1687,7 @@ Foam::isoSurface::isoSurface
|
||||
|
||||
forAll(*this, triI)
|
||||
{
|
||||
// Copied from surfaceCheck
|
||||
validTri(*this, triI);
|
||||
triSurfaceTools::validTri(*this, triI);
|
||||
}
|
||||
|
||||
fileName stlFile = mesh_.time().path() + ".stl";
|
||||
|
||||
@ -377,9 +377,6 @@ class isoSurface
|
||||
List<FixedList<scalar, 3>>& interpolationWeights
|
||||
);
|
||||
|
||||
//- Check single triangle for (topological) validity
|
||||
static bool validTri(const triSurface&, const label facei);
|
||||
|
||||
static triSurface subsetMesh
|
||||
(
|
||||
const triSurface& s,
|
||||
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "mergePoints.H"
|
||||
#include "tetMatcher.H"
|
||||
#include "syncTools.H"
|
||||
#include "triSurfaceTools.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Time.H"
|
||||
#include "triPoints.H"
|
||||
@ -1049,73 +1050,6 @@ Foam::triSurface Foam::isoSurfaceCell::stitchTriPoints
|
||||
}
|
||||
|
||||
|
||||
bool Foam::isoSurfaceCell::validTri(const triSurface& surf, const label facei)
|
||||
{
|
||||
// Simple check on indices ok.
|
||||
|
||||
const labelledTri& f = surf[facei];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (f[fp] < 0 || f[fp] >= surf.points().size())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei << " vertices " << f
|
||||
<< " uses point indices outside point range 0.."
|
||||
<< surf.points().size()-1 << endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((f[0] == f[1]) || (f[0] == f[2]) || (f[1] == f[2]))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei
|
||||
<< " uses non-unique vertices " << f
|
||||
<< endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// duplicate triangle check
|
||||
|
||||
const labelList& fFaces = surf.faceFaces()[facei];
|
||||
|
||||
// Check if faceNeighbours use same points as this face.
|
||||
// Note: discards normal information - sides of baffle are merged.
|
||||
forAll(fFaces, i)
|
||||
{
|
||||
label nbrFacei = fFaces[i];
|
||||
|
||||
if (nbrFacei <= facei)
|
||||
{
|
||||
// lower numbered faces already checked
|
||||
continue;
|
||||
}
|
||||
|
||||
const labelledTri& nbrF = surf[nbrFacei];
|
||||
|
||||
if
|
||||
(
|
||||
((f[0] == nbrF[0]) || (f[0] == nbrF[1]) || (f[0] == nbrF[2]))
|
||||
&& ((f[1] == nbrF[0]) || (f[1] == nbrF[1]) || (f[1] == nbrF[2]))
|
||||
&& ((f[2] == nbrF[0]) || (f[2] == nbrF[1]) || (f[2] == nbrF[2]))
|
||||
)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "triangle " << facei << " vertices " << f
|
||||
<< " coords:" << f.points(surf.points())
|
||||
<< " has the same vertices as triangle " << nbrFacei
|
||||
<< " vertices " << nbrF
|
||||
<< endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::isoSurfaceCell::calcAddressing
|
||||
(
|
||||
const triSurface& surf,
|
||||
@ -1569,8 +1503,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
|
||||
|
||||
forAll(*this, triI)
|
||||
{
|
||||
// Copied from surfaceCheck
|
||||
validTri(*this, triI);
|
||||
triSurfaceTools::validTri(*this, triI);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -272,9 +272,6 @@ class isoSurfaceCell
|
||||
labelList& triMap // merged to unmerged triangle
|
||||
) const;
|
||||
|
||||
//- Check single triangle for (topological) validity
|
||||
static bool validTri(const triSurface&, const label);
|
||||
|
||||
//- Determine edge-face addressing
|
||||
void calcAddressing
|
||||
(
|
||||
|
||||
@ -169,7 +169,7 @@ public:
|
||||
//- For every face original cell in mesh
|
||||
const labelList& meshCells() const
|
||||
{
|
||||
return cuttingPlane::cutCells();
|
||||
return cuttingPlane::meshCells();
|
||||
}
|
||||
|
||||
//- Sample field on surface
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -72,8 +72,32 @@ Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::MeshedSurfaceIOAllocator::~MeshedSurfaceIOAllocator()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::MeshedSurfaceIOAllocator::setInstance(const fileName& inst)
|
||||
{
|
||||
points_.instance() = inst;
|
||||
faces_.instance() = inst;
|
||||
zones_.instance() = inst;
|
||||
}
|
||||
|
||||
|
||||
void Foam::MeshedSurfaceIOAllocator::setWriteOption(IOobject::writeOption w)
|
||||
{
|
||||
points_.writeOpt() = w;
|
||||
faces_.writeOpt() = w;
|
||||
zones_.writeOpt() = w;
|
||||
}
|
||||
|
||||
|
||||
void Foam::MeshedSurfaceIOAllocator::clear()
|
||||
{
|
||||
points_.clear();
|
||||
@ -136,4 +160,20 @@ void Foam::MeshedSurfaceIOAllocator::reset
|
||||
}
|
||||
|
||||
|
||||
bool Foam::MeshedSurfaceIOAllocator::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp
|
||||
) const
|
||||
{
|
||||
return
|
||||
(
|
||||
points_.writeObject(fmt, ver, cmp)
|
||||
&& faces_.writeObject(fmt, ver, cmp)
|
||||
&& zones_.writeObject(fmt, ver, cmp)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -106,8 +106,21 @@ public:
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~MeshedSurfaceIOAllocator();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Database
|
||||
|
||||
//- Set the instance for mesh files
|
||||
void setInstance(const fileName&);
|
||||
|
||||
//- Adjust the write option for all components
|
||||
void setWriteOption(IOobject::writeOption);
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Non-const access to the points
|
||||
@ -177,6 +190,18 @@ public:
|
||||
const Xfer<faceList>& faces,
|
||||
const Xfer<surfZoneList>& zones
|
||||
);
|
||||
|
||||
|
||||
// Writing
|
||||
|
||||
//- Write using given format, version and compression
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -229,18 +229,25 @@ Foam::surfMesh::~surfMesh()
|
||||
|
||||
void Foam::surfMesh::updatePointsRef()
|
||||
{
|
||||
// Assign the reference to the points (this is truly ugly)
|
||||
reinterpret_cast<SubField<point>&>
|
||||
// Assign the reference to the points (quite ugly)
|
||||
// points() are returned as Field but are actually stored as SubField
|
||||
reinterpret_cast<typename MeshReference::PointFieldType&>
|
||||
(
|
||||
const_cast<Field<point>&>(MeshReference::points())
|
||||
) = reinterpret_cast<SubField<point>&>(this->storedPoints());
|
||||
).shallowCopy
|
||||
(
|
||||
this->storedPoints()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::surfMesh::updateFacesRef()
|
||||
{
|
||||
// Assign the reference to the faces
|
||||
shallowCopy(this->storedFaces());
|
||||
// Assign the reference to the faces (UList)
|
||||
static_cast<MeshReference&>(*this).shallowCopy
|
||||
(
|
||||
this->storedFaces()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -186,7 +186,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Database
|
||||
// Database
|
||||
|
||||
//- Return the local mesh directory (dbDir()/meshSubDir)
|
||||
fileName meshDir() const;
|
||||
@ -200,10 +200,17 @@ public:
|
||||
const fileName& facesInstance() const;
|
||||
|
||||
//- Set the instance for mesh files
|
||||
void setInstance(const fileName&);
|
||||
void setInstance
|
||||
(
|
||||
const fileName&,
|
||||
IOobject::writeOption = IOobject::AUTO_WRITE
|
||||
);
|
||||
|
||||
//- Adjust the write option for all components
|
||||
void setWriteOption(IOobject::writeOption);
|
||||
|
||||
|
||||
// Access
|
||||
// Access
|
||||
|
||||
//- Return the number of raw points
|
||||
virtual label nPoints() const;
|
||||
@ -263,7 +270,6 @@ public:
|
||||
// time directories
|
||||
virtual readUpdateState readUpdate();
|
||||
|
||||
//- Update the mesh corresponding to given map
|
||||
|
||||
//- Remove surface zones
|
||||
void removeZones();
|
||||
@ -291,16 +297,27 @@ public:
|
||||
void transfer(MeshedSurface<face>&);
|
||||
|
||||
|
||||
// Writing
|
||||
|
||||
//- Avoid masking the normal objectRegistry write
|
||||
using surfaceRegistry::write;
|
||||
|
||||
//- Write all components using given format, version and compression
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp
|
||||
) const;
|
||||
|
||||
//- Write to file
|
||||
static void write(const fileName&, const surfMesh&);
|
||||
|
||||
//- Write to file
|
||||
void write(const fileName&);
|
||||
|
||||
// Storage management
|
||||
|
||||
// Storage management
|
||||
|
||||
//- Transfer contents to the Xfer container as a MeshedSurface
|
||||
Xfer<MeshedSurface<face>> xfer();
|
||||
@ -322,6 +339,7 @@ public:
|
||||
|
||||
//- Remove all files from mesh instance()
|
||||
void removeFiles() const;
|
||||
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,7 +28,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::surfMesh::setInstance(const fileName& inst)
|
||||
void Foam::surfMesh::setInstance(const fileName& inst, IOobject::writeOption w)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -36,15 +36,16 @@ void Foam::surfMesh::setInstance(const fileName& inst)
|
||||
}
|
||||
|
||||
instance() = inst;
|
||||
Allocator::setInstance(inst);
|
||||
|
||||
storedIOPoints().writeOpt() = IOobject::AUTO_WRITE;
|
||||
storedIOPoints().instance() = inst;
|
||||
setWriteOption(w);
|
||||
}
|
||||
|
||||
storedIOFaces().writeOpt() = IOobject::AUTO_WRITE;
|
||||
storedIOFaces().instance() = inst;
|
||||
|
||||
storedIOZones().writeOpt() = IOobject::AUTO_WRITE;
|
||||
storedIOZones().instance() = inst;
|
||||
void Foam::surfMesh::setWriteOption(IOobject::writeOption w)
|
||||
{
|
||||
writeOpt() = w;
|
||||
Allocator::setWriteOption(w);
|
||||
}
|
||||
|
||||
|
||||
@ -199,4 +200,15 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
|
||||
}
|
||||
|
||||
|
||||
bool Foam::surfMesh::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp
|
||||
) const
|
||||
{
|
||||
return Allocator::writeObject(fmt, ver, cmp);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -24,6 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "surfacePatch.H"
|
||||
#include "surfZone.H"
|
||||
#include "dictionary.H"
|
||||
#include "word.H"
|
||||
|
||||
@ -38,7 +39,15 @@ namespace Foam
|
||||
|
||||
Foam::surfacePatch::surfacePatch()
|
||||
:
|
||||
geometricSurfacePatch("", "", -1),
|
||||
geometricSurfacePatch(word::null, word::null, -1),
|
||||
size_(0),
|
||||
start_(0)
|
||||
{}
|
||||
|
||||
|
||||
Foam::surfacePatch::surfacePatch(const label index)
|
||||
:
|
||||
geometricSurfacePatch(word::null, word::null, index),
|
||||
size_(0),
|
||||
start_(0)
|
||||
{}
|
||||
@ -83,7 +92,7 @@ Foam::surfacePatch::surfacePatch
|
||||
{}
|
||||
|
||||
|
||||
Foam::surfacePatch::surfacePatch(const Foam::surfacePatch& sp)
|
||||
Foam::surfacePatch::surfacePatch(const surfacePatch& sp)
|
||||
:
|
||||
geometricSurfacePatch(sp),
|
||||
size_(sp.size()),
|
||||
@ -114,6 +123,19 @@ void Foam::surfacePatch::writeDict(Ostream& os) const
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfacePatch::operator Foam::surfZone() const
|
||||
{
|
||||
return surfZone
|
||||
(
|
||||
this->name(),
|
||||
this->size(),
|
||||
this->start(),
|
||||
this->index(),
|
||||
this->geometricType()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::surfacePatch::operator!=(const surfacePatch& p) const
|
||||
{
|
||||
return !(*this == p);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,8 +36,6 @@ SourceFiles
|
||||
#define surfacePatch_H
|
||||
|
||||
#include "geometricSurfacePatch.H"
|
||||
#include "word.H"
|
||||
#include "label.H"
|
||||
#include "className.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -48,12 +46,13 @@ namespace Foam
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class surfacePatch;
|
||||
class surfZone;
|
||||
|
||||
Ostream& operator<<(Ostream&, const surfacePatch&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class surfacePatch Declaration
|
||||
Class surfacePatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class surfacePatch
|
||||
@ -79,6 +78,9 @@ public:
|
||||
//- Construct null
|
||||
surfacePatch();
|
||||
|
||||
//- Construct null with specified index
|
||||
explicit surfacePatch(const label index);
|
||||
|
||||
//- Construct from components
|
||||
surfacePatch
|
||||
(
|
||||
@ -106,25 +108,25 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return start label of this patch in the polyMesh face list
|
||||
//- Return start label of this patch in the face list
|
||||
label start() const
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
|
||||
//- Return start label of this patch in the polyMesh face list
|
||||
//- Return start label of this patch in the face list
|
||||
label& start()
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
|
||||
//- Return size of this patch in the polyMesh face list
|
||||
//- Return size of this patch in the face list
|
||||
label size() const
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
//- Return size of this patch in the polyMesh face list
|
||||
//- Return size of this patch in the face list
|
||||
label& size()
|
||||
{
|
||||
return size_;
|
||||
@ -139,11 +141,17 @@ public:
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Conversion to surfZone representation
|
||||
explicit operator surfZone() const;
|
||||
|
||||
|
||||
//- Compare.
|
||||
bool operator!=(const surfacePatch&) const;
|
||||
|
||||
//- compare.
|
||||
//- Compare.
|
||||
bool operator==(const surfacePatch&) const;
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const surfacePatch&);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,6 +31,7 @@ License
|
||||
#include "boundBox.H"
|
||||
#include "SortableList.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "surfZoneList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -488,7 +489,8 @@ void Foam::triSurface::write
|
||||
|
||||
// Returns patch info. Sets faceMap to the indexing according to patch
|
||||
// numbers. Patch numbers start at 0.
|
||||
Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const
|
||||
Foam::surfacePatchList
|
||||
Foam::triSurface::calcPatches(labelList& faceMap) const
|
||||
{
|
||||
// Sort according to region numbers of labelledTri
|
||||
SortableList<label> sortedRegion(size());
|
||||
@ -533,30 +535,29 @@ Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const
|
||||
surfacePatch& newPatch = newPatches[newPatchi];
|
||||
|
||||
newPatch.index() = newPatchi;
|
||||
|
||||
label oldPatchi = newPatchi;
|
||||
|
||||
// start of patch
|
||||
newPatch.start() = startFacei;
|
||||
|
||||
|
||||
// Take over any information from existing patches
|
||||
if ((oldPatchi < patches_.size()) && (patches_[oldPatchi].name() != ""))
|
||||
if
|
||||
(
|
||||
newPatchi < patches_.size()
|
||||
&& !patches_[newPatchi].name().empty()
|
||||
)
|
||||
{
|
||||
newPatch.name() = patches_[oldPatchi].name();
|
||||
newPatch.name() = patches_[newPatchi].name();
|
||||
}
|
||||
else
|
||||
{
|
||||
newPatch.name() = word("patch") + name(newPatchi);
|
||||
newPatch.name() = word("patch") + Foam::name(newPatchi);
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
(oldPatchi < patches_.size())
|
||||
&& (patches_[oldPatchi].geometricType() != "")
|
||||
newPatchi < patches_.size()
|
||||
&& !patches_[newPatchi].geometricType().empty()
|
||||
)
|
||||
{
|
||||
newPatch.geometricType() = patches_[oldPatchi].geometricType();
|
||||
newPatch.geometricType() = patches_[newPatchi].geometricType();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -829,6 +830,42 @@ void Foam::triSurface::cleanup(const bool verbose)
|
||||
}
|
||||
|
||||
|
||||
Foam::List<Foam::surfZone>
|
||||
Foam::triSurface::sortedZones(labelList& faceMap) const
|
||||
{
|
||||
surfacePatchList patches(calcPatches(faceMap));
|
||||
|
||||
surfZoneList zones(patches.size());
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
zones[patchi] = surfZone(patches[patchi]);
|
||||
}
|
||||
|
||||
return zones;
|
||||
}
|
||||
|
||||
|
||||
void Foam::triSurface::triFaceFaces(List<face>& plainFaces) const
|
||||
{
|
||||
plainFaces.setSize(size());
|
||||
|
||||
forAll(*this, facei)
|
||||
{
|
||||
plainFaces[facei] = operator[](facei).triFaceFace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::Xfer<Foam::List<Foam::point>>
|
||||
Foam::triSurface::xferPoints()
|
||||
{
|
||||
// Topology changed because of transfer
|
||||
clearOut();
|
||||
|
||||
return this->storedPoints().xfer();
|
||||
}
|
||||
|
||||
|
||||
// Finds area, starting at facei, delimited by borderEdge. Marks all visited
|
||||
// faces (from face-edge-face walk) with currentZone.
|
||||
void Foam::triSurface::markZone
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -50,7 +50,7 @@ namespace Foam
|
||||
|
||||
class Time;
|
||||
class IFstream;
|
||||
|
||||
class surfZone;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
@ -354,6 +354,17 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Interoperability with other surface mesh classes
|
||||
|
||||
//- Sort faces according to zoneIds
|
||||
// Returns a surfZoneList and sets faceMap to index within faces()
|
||||
// (i.e. map from original,unsorted to sorted)
|
||||
List<surfZone> sortedZones(labelList& faceMap) const;
|
||||
|
||||
//- Create a list of faces from the triFaces
|
||||
void triFaceFaces(List<face>& plainFaceList) const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Move points
|
||||
@ -412,6 +423,10 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
//- Transfer stored points to an Xfer container
|
||||
Xfer<List<point>> xferPoints();
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
//- Write to Ostream in simple FOAM format
|
||||
|
||||
BIN
tutorials/resources/geometry/motorBike-passenger-helmet.obj.gz
Normal file
BIN
tutorials/resources/geometry/motorBike-passenger-helmet.obj.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user