mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: featureEdgeMesh : moved new stuff to extendedFeatureEdgeMesh
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,6 +36,7 @@ Description
|
||||
#include "Time.H"
|
||||
#include "surfaceFeatures.H"
|
||||
#include "featureEdgeMesh.H"
|
||||
#include "extendedFeatureEdgeMesh.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "meshTools.H"
|
||||
#include "OFstream.H"
|
||||
@ -298,20 +299,46 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Extracting and writing a featureEdgeMesh
|
||||
|
||||
Pout<< nl << "Writing featureEdgeMesh to constant/featureEdgeMesh."
|
||||
<< endl;
|
||||
|
||||
featureEdgeMesh feMesh
|
||||
extendedFeatureEdgeMesh feMesh
|
||||
(
|
||||
newSet,
|
||||
runTime,
|
||||
surfFileName.lessExt().name() + ".featureEdgeMesh"
|
||||
);
|
||||
|
||||
Info<< nl << "Writing extendedFeatureEdgeMesh to " << feMesh.objectPath()
|
||||
<< endl;
|
||||
|
||||
|
||||
feMesh.writeObj(surfFileName.lessExt().name());
|
||||
|
||||
feMesh.write();
|
||||
|
||||
|
||||
// Write a featureEdgeMesh for backwards compatibility
|
||||
{
|
||||
featureEdgeMesh bfeMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
surfFileName.lessExt().name() + ".eMesh", // name
|
||||
runTime.constant(), // instance
|
||||
"triSurface",
|
||||
runTime, // registry
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE,
|
||||
false
|
||||
),
|
||||
feMesh.points(),
|
||||
feMesh.edges()
|
||||
);
|
||||
|
||||
Info<< nl << "Writing featureEdgeMesh to "
|
||||
<< bfeMesh.objectPath() << endl;
|
||||
|
||||
bfeMesh.regIOobject::write();
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
@ -20,7 +20,10 @@ $(edgeFormats)/starcd/STARCDedgeFormatRunTime.C
|
||||
$(edgeFormats)/vtk/VTKedgeFormat.C
|
||||
$(edgeFormats)/vtk/VTKedgeFormatRunTime.C
|
||||
|
||||
extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C
|
||||
|
||||
featureEdgeMesh/featureEdgeMesh.C
|
||||
|
||||
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libedgeMesh
|
||||
|
||||
1028
src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C
Normal file
1028
src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C
Normal file
File diff suppressed because it is too large
Load Diff
377
src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H
Normal file
377
src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H
Normal file
@ -0,0 +1,377 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::extendedFeatureEdgeMesh
|
||||
|
||||
Description
|
||||
|
||||
Description of feature edges and points.
|
||||
|
||||
Feature points are a sorted subset at the start of the overall points list:
|
||||
0 .. concaveStart_-1 : convex points (w.r.t normals)
|
||||
concaveStart_-1 .. mixedStart_-1 : concave points
|
||||
mixedStart_ .. nonFeatureStart_ : mixed internal/external points
|
||||
nonFeatureStart_ .. size-1 : non-feature points
|
||||
|
||||
Feature edges are the edgeList of the edgeMesh and are sorted:
|
||||
0 .. internalStart_-1 : external edges (convex w.r.t normals)
|
||||
internalStart_ .. flatStart_-1 : internal edges (concave)
|
||||
flatStart_ .. openStart_-1 : flat edges (neither concave or convex)
|
||||
can arise from region interfaces on
|
||||
flat surfaces
|
||||
openStart_ .. multipleStart_-1 : open edges (e.g. from baffle surfaces)
|
||||
multipleStart_ .. size-1 : multiply connected edges
|
||||
|
||||
The edge direction and feature edge and feature point adjacent normals
|
||||
are stored.
|
||||
|
||||
SourceFiles
|
||||
extendedFeatureEdgeMeshI.H
|
||||
extendedFeatureEdgeMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef extendedFeatureEdgeMesh_H
|
||||
#define extendedFeatureEdgeMesh_H
|
||||
|
||||
#include "edgeMesh.H"
|
||||
#include "surfaceFeatures.H"
|
||||
#include "objectRegistry.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "treeDataEdge.H"
|
||||
#include "pointIndexHit.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class extendedFeatureEdgeMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class extendedFeatureEdgeMesh
|
||||
:
|
||||
public regIOobject,
|
||||
public edgeMesh
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("extendedFeatureEdgeMesh");
|
||||
|
||||
enum pointStatus
|
||||
{
|
||||
CONVEX, // Fully convex point (w.r.t normals)
|
||||
CONCAVE, // Fully concave point
|
||||
MIXED, // A point surrounded by both convex and concave edges
|
||||
NONFEATURE // Not a feature point
|
||||
};
|
||||
|
||||
enum edgeStatus
|
||||
{
|
||||
EXTERNAL, // "Convex" edge
|
||||
INTERNAL, // "Concave" edge
|
||||
FLAT, // Neither concave or convex, on a flat surface
|
||||
OPEN, // i.e. only connected to one face
|
||||
MULTIPLE, // Multiply connected (connected to more than two faces)
|
||||
NONE // Not a classified feature edge (consistency with
|
||||
// surfaceFeatures)
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
// Static data
|
||||
|
||||
//- Angular closeness tolerance for treating normals as the same
|
||||
static scalar cosNormalAngleTol_;
|
||||
|
||||
//- Index of the start of the convex feature points - static as 0
|
||||
static label convexStart_;
|
||||
|
||||
//- Index of the start of the external feature edges - static as 0
|
||||
static label externalStart_;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Index of the start of the concave feature points
|
||||
label concaveStart_;
|
||||
|
||||
//- Index of the start of the mixed type feature points
|
||||
label mixedStart_;
|
||||
|
||||
//- Index of the start of the non-feature points
|
||||
label nonFeatureStart_;
|
||||
|
||||
//- Index of the start of the internal feature edges
|
||||
label internalStart_;
|
||||
|
||||
//- Index of the start of the flat feature edges
|
||||
label flatStart_;
|
||||
|
||||
//- Index of the start of the open feature edges
|
||||
label openStart_;
|
||||
|
||||
//- Index of the start of the multiply-connected feature edges
|
||||
label multipleStart_;
|
||||
|
||||
//- Normals of the features, to be referred to by index by both feature
|
||||
// points and edges, unsorted
|
||||
vectorField normals_;
|
||||
|
||||
//- Flat and open edges require the direction of the edge
|
||||
vectorField edgeDirections_;
|
||||
|
||||
//- Indices of the normals that are adjacent to the feature edges
|
||||
labelListList edgeNormals_;
|
||||
|
||||
//- Indices of the normals that are adjacent to the feature points
|
||||
labelListList featurePointNormals_;
|
||||
|
||||
//- Feature edges which are on the boundary between regions
|
||||
labelList regionEdges_;
|
||||
|
||||
//- Search tree for all edges
|
||||
mutable autoPtr<indexedOctree<treeDataEdge> > edgeTree_;
|
||||
|
||||
//- Individual search trees for each type of edge
|
||||
mutable PtrList<indexedOctree<treeDataEdge> > edgeTreesByType_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Classify the type of feature point. Requires valid stored member
|
||||
// data for edges and normals.
|
||||
pointStatus classifyFeaturePoint(label ptI) const;
|
||||
|
||||
//- Classify the type of feature edge. Requires face centre 0 to face
|
||||
// centre 1 vector to distinguish internal from external
|
||||
edgeStatus classifyEdge
|
||||
(
|
||||
const List<vector>& norms,
|
||||
const labelList& edNorms,
|
||||
const vector& fC0tofC1
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static data
|
||||
|
||||
//- Number of possible point types (i.e. number of slices)
|
||||
static label nPointTypes;
|
||||
|
||||
//- Number of possible feature edge types (i.e. number of slices)
|
||||
static label nEdgeTypes;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct (read) given an IOobject
|
||||
extendedFeatureEdgeMesh(const IOobject&);
|
||||
|
||||
//- Construct as copy
|
||||
explicit extendedFeatureEdgeMesh
|
||||
(
|
||||
const IOobject&,
|
||||
const extendedFeatureEdgeMesh&
|
||||
);
|
||||
|
||||
//- Construct by transferring components (points, edges)
|
||||
extendedFeatureEdgeMesh
|
||||
(
|
||||
const IOobject&,
|
||||
const Xfer<pointField>&,
|
||||
const Xfer<edgeList>&
|
||||
);
|
||||
|
||||
//- Construct (read) given surfaceFeatures, an objectRegistry and a
|
||||
// fileName to write to. Extracts, classifies and reorders the data
|
||||
// from surfaceFeatures.
|
||||
extendedFeatureEdgeMesh
|
||||
(
|
||||
const surfaceFeatures& sFeat,
|
||||
const objectRegistry& obr,
|
||||
const fileName& sFeatFileName
|
||||
);
|
||||
|
||||
//- Construct from all components
|
||||
extendedFeatureEdgeMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const pointField& pts,
|
||||
const edgeList& eds,
|
||||
label concaveStart,
|
||||
label mixedStart,
|
||||
label nonFeatureStart,
|
||||
label internalStart,
|
||||
label flatStart,
|
||||
label openStart,
|
||||
label multipleStart,
|
||||
const vectorField& normals,
|
||||
const vectorField& edgeDirections,
|
||||
const labelListList& edgeNormals,
|
||||
const labelListList& featurePointNormals,
|
||||
const labelList& regionEdges
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~extendedFeatureEdgeMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Find
|
||||
|
||||
//- Find nearest surface edge for the sample point.
|
||||
void nearestFeatureEdge
|
||||
(
|
||||
const point& sample,
|
||||
scalar searchDistSqr,
|
||||
pointIndexHit& info
|
||||
) const;
|
||||
|
||||
//- Find nearest surface edge for each sample point.
|
||||
void nearestFeatureEdge
|
||||
(
|
||||
const pointField& samples,
|
||||
const scalarField& searchDistSqr,
|
||||
List<pointIndexHit>& info
|
||||
) const;
|
||||
|
||||
//- Find the nearest point on each type of feature edge
|
||||
void nearestFeatureEdgeByType
|
||||
(
|
||||
const point& sample,
|
||||
const scalarField& searchDistSqr,
|
||||
List<pointIndexHit>& info
|
||||
) const;
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the index of the start of the convex feature points
|
||||
inline label convexStart() const;
|
||||
|
||||
//- Return the index of the start of the concave feature points
|
||||
inline label concaveStart() const;
|
||||
|
||||
//- Return the index of the start of the mixed type feature points
|
||||
inline label mixedStart() const;
|
||||
|
||||
//- Return the index of the start of the non-feature points
|
||||
inline label nonFeatureStart() const;
|
||||
|
||||
//- Return the index of the start of the external feature edges
|
||||
inline label externalStart() const;
|
||||
|
||||
//- Return the index of the start of the internal feature edges
|
||||
inline label internalStart() const;
|
||||
|
||||
//- Return the index of the start of the flat feature edges
|
||||
inline label flatStart() const;
|
||||
|
||||
//- Return the index of the start of the open feature edges
|
||||
inline label openStart() const;
|
||||
|
||||
//- Return the index of the start of the multiply-connected feature
|
||||
// edges
|
||||
inline label multipleStart() const;
|
||||
|
||||
//- Return whether or not the point index is a feature point
|
||||
inline bool featurePoint(label ptI) const;
|
||||
|
||||
//- Return the normals of the surfaces adjacent to the feature edges
|
||||
// and points
|
||||
inline const vectorField& normals() const;
|
||||
|
||||
//- Return the edgeDirection vectors
|
||||
inline const vectorField& edgeDirections() const;
|
||||
|
||||
//- Return the direction of edgeI, pointing away from ptI
|
||||
inline vector edgeDirection(label edgeI, label ptI) const;
|
||||
|
||||
//- Return the indices of the normals that are adjacent to the
|
||||
// feature edges
|
||||
inline const labelListList& edgeNormals() const;
|
||||
|
||||
//- Return the normal vectors for a given set of normal indices
|
||||
inline vectorField edgeNormals(const labelList& edgeNormIs) const;
|
||||
|
||||
//- Return the normal vectors for a given edge
|
||||
inline vectorField edgeNormals(label edgeI) const;
|
||||
|
||||
//- Return the indices of the normals that are adjacent to the
|
||||
// feature points
|
||||
inline const labelListList& featurePointNormals() const;
|
||||
|
||||
//- Return the normal vectors for a given feature point
|
||||
inline vectorField featurePointNormals(label ptI) const;
|
||||
|
||||
//- Return the feature edges which are on the boundary between
|
||||
// regions
|
||||
inline const labelList& regionEdges() const;
|
||||
|
||||
//- Return the pointStatus of a specified point
|
||||
inline pointStatus getPointStatus(label ptI) const;
|
||||
|
||||
//- Return the edgeStatus of a specified edge
|
||||
inline edgeStatus getEdgeStatus(label edgeI) const;
|
||||
|
||||
//- Demand driven construction of octree for boundary edges
|
||||
const indexedOctree<treeDataEdge>& edgeTree() const;
|
||||
|
||||
//- Demand driven construction of octree for boundary edges by type
|
||||
const PtrList<indexedOctree<treeDataEdge> >&
|
||||
edgeTreesByType() const;
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
//- Write all components of the extendedFeatureEdgeMesh as obj files
|
||||
void writeObj(const fileName& prefix) const;
|
||||
|
||||
//- Give precedence to the regIOobject write
|
||||
using regIOobject::write;
|
||||
|
||||
//- WriteData function required for regIOobject write operation
|
||||
virtual bool writeData(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "extendedFeatureEdgeMeshI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,78 +25,79 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::convexStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::convexStart() const
|
||||
{
|
||||
return convexStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::concaveStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::concaveStart() const
|
||||
{
|
||||
return concaveStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::mixedStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::mixedStart() const
|
||||
{
|
||||
return mixedStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::nonFeatureStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::nonFeatureStart() const
|
||||
{
|
||||
return nonFeatureStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::externalStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::externalStart() const
|
||||
{
|
||||
return externalStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::internalStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::internalStart() const
|
||||
{
|
||||
return internalStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::flatStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::flatStart() const
|
||||
{
|
||||
return flatStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::openStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::openStart() const
|
||||
{
|
||||
return openStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::multipleStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::multipleStart() const
|
||||
{
|
||||
return multipleStart_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::featureEdgeMesh::featurePoint(label ptI) const
|
||||
inline bool Foam::extendedFeatureEdgeMesh::featurePoint(label ptI) const
|
||||
{
|
||||
return ptI < nonFeatureStart_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::vectorField& Foam::featureEdgeMesh::normals() const
|
||||
inline const Foam::vectorField& Foam::extendedFeatureEdgeMesh::normals() const
|
||||
{
|
||||
return normals_;
|
||||
}
|
||||
|
||||
inline const Foam::vectorField& Foam::featureEdgeMesh::edgeDirections() const
|
||||
inline const Foam::vectorField& Foam::extendedFeatureEdgeMesh::edgeDirections()
|
||||
const
|
||||
{
|
||||
return edgeDirections_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::vector Foam::featureEdgeMesh::edgeDirection
|
||||
inline Foam::vector Foam::extendedFeatureEdgeMesh::edgeDirection
|
||||
(
|
||||
label edgeI,
|
||||
label ptI
|
||||
@ -114,7 +115,7 @@ inline Foam::vector Foam::featureEdgeMesh::edgeDirection
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("Foam::featureEdgeMesh::edgedirection")
|
||||
FatalErrorIn("Foam::extendedFeatureEdgeMesh::edgedirection")
|
||||
<< "Requested ptI " << ptI << " is not a point on the requested "
|
||||
<< "edgeI " << edgeI << ". edgeI start and end: "
|
||||
<< e.start() << " " << e.end()
|
||||
@ -125,13 +126,14 @@ inline Foam::vector Foam::featureEdgeMesh::edgeDirection
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelListList& Foam::featureEdgeMesh::edgeNormals() const
|
||||
inline const Foam::labelListList& Foam::extendedFeatureEdgeMesh::edgeNormals()
|
||||
const
|
||||
{
|
||||
return edgeNormals_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::vectorField Foam::featureEdgeMesh::edgeNormals
|
||||
inline Foam::vectorField Foam::extendedFeatureEdgeMesh::edgeNormals
|
||||
(
|
||||
const labelList& edgeNormIs
|
||||
) const
|
||||
@ -147,27 +149,28 @@ inline Foam::vectorField Foam::featureEdgeMesh::edgeNormals
|
||||
}
|
||||
|
||||
|
||||
inline Foam::vectorField Foam::featureEdgeMesh::edgeNormals(label edgeI) const
|
||||
inline Foam::vectorField Foam::extendedFeatureEdgeMesh::edgeNormals(label edgeI)
|
||||
const
|
||||
{
|
||||
return edgeNormals(edgeNormals_[edgeI]);
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelListList&
|
||||
Foam::featureEdgeMesh::featurePointNormals() const
|
||||
Foam::extendedFeatureEdgeMesh::featurePointNormals() const
|
||||
{
|
||||
return featurePointNormals_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::vectorField Foam::featureEdgeMesh::featurePointNormals
|
||||
inline Foam::vectorField Foam::extendedFeatureEdgeMesh::featurePointNormals
|
||||
(
|
||||
label ptI
|
||||
) const
|
||||
{
|
||||
if (!featurePoint(ptI))
|
||||
{
|
||||
WarningIn("vectorField featureEdgeMesh::featurePointNormals")
|
||||
WarningIn("vectorField extendedFeatureEdgeMesh::featurePointNormals")
|
||||
<< "Requesting the normals of a non-feature point. "
|
||||
<< "Returned zero length vectorField."
|
||||
<< endl;
|
||||
@ -188,13 +191,14 @@ inline Foam::vectorField Foam::featureEdgeMesh::featurePointNormals
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList& Foam::featureEdgeMesh::regionEdges() const
|
||||
inline const Foam::labelList& Foam::extendedFeatureEdgeMesh::regionEdges() const
|
||||
{
|
||||
return regionEdges_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::featureEdgeMesh::pointStatus Foam::featureEdgeMesh::getPointStatus
|
||||
inline Foam::extendedFeatureEdgeMesh::pointStatus
|
||||
Foam::extendedFeatureEdgeMesh::getPointStatus
|
||||
(
|
||||
label ptI
|
||||
) const
|
||||
@ -218,7 +222,8 @@ inline Foam::featureEdgeMesh::pointStatus Foam::featureEdgeMesh::getPointStatus
|
||||
}
|
||||
|
||||
|
||||
inline Foam::featureEdgeMesh::edgeStatus Foam::featureEdgeMesh::getEdgeStatus
|
||||
inline Foam::extendedFeatureEdgeMesh::edgeStatus
|
||||
Foam::extendedFeatureEdgeMesh::getEdgeStatus
|
||||
(
|
||||
label edgeI
|
||||
) const
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,27 +25,12 @@ Class
|
||||
Foam::featureEdgeMesh
|
||||
|
||||
Description
|
||||
edgeMesh + IO.
|
||||
|
||||
Feature points are a sorted subset at the start of the overall points list:
|
||||
0 .. concaveStart_-1 : convex points (w.r.t normals)
|
||||
concaveStart_-1 .. mixedStart_-1 : concave points
|
||||
mixedStart_ .. nonFeatureStart_ : mixed internal/external points
|
||||
nonFeatureStart_ .. size-1 : non-feature points
|
||||
|
||||
Feature edges are the edgeList of the edgeMesh and are sorted:
|
||||
0 .. internalStart_-1 : external edges (convex w.r.t normals)
|
||||
internalStart_ .. flatStart_-1 : internal edges (concave)
|
||||
flatStart_ .. openStart_-1 : flat edges (neither concave or convex)
|
||||
can arise from region interfaces on
|
||||
flat surfaces
|
||||
openStart_ .. multipleStart_-1 : open edges (e.g. from baffle surfaces)
|
||||
multipleStart_ .. size-1 : multiply connected edges
|
||||
|
||||
The edge direction and feature edge and feature point adjacent normals
|
||||
are stored.
|
||||
See also extendedFeatureEdgeMesh type which stores additional classification
|
||||
of features.
|
||||
|
||||
SourceFiles
|
||||
featureEdgeMeshI.H
|
||||
featureEdgeMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -54,12 +39,7 @@ SourceFiles
|
||||
#define featureEdgeMesh_H
|
||||
|
||||
#include "edgeMesh.H"
|
||||
#include "surfaceFeatures.H"
|
||||
#include "objectRegistry.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "treeDataEdge.H"
|
||||
#include "pointIndexHit.H"
|
||||
#include "regIOobject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -78,278 +58,28 @@ class featureEdgeMesh
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("featureEdgeMesh");
|
||||
|
||||
enum pointStatus
|
||||
{
|
||||
CONVEX, // Fully convex point (w.r.t normals)
|
||||
CONCAVE, // Fully concave point
|
||||
MIXED, // A point surrounded by both convex and concave edges
|
||||
NONFEATURE // Not a feature point
|
||||
};
|
||||
|
||||
enum edgeStatus
|
||||
{
|
||||
EXTERNAL, // "Convex" edge
|
||||
INTERNAL, // "Concave" edge
|
||||
FLAT, // Neither concave or convex, on a flat surface
|
||||
OPEN, // i.e. only connected to one face
|
||||
MULTIPLE, // Multiply connected (connected to more than two faces)
|
||||
NONE // Not a classified feature edge (consistency with
|
||||
// surfaceFeatures)
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
// Static data
|
||||
|
||||
//- Angular closeness tolerance for treating normals as the same
|
||||
static scalar cosNormalAngleTol_;
|
||||
|
||||
//- Index of the start of the convex feature points - static as 0
|
||||
static label convexStart_;
|
||||
|
||||
//- Index of the start of the external feature edges - static as 0
|
||||
static label externalStart_;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Index of the start of the concave feature points
|
||||
label concaveStart_;
|
||||
|
||||
//- Index of the start of the mixed type feature points
|
||||
label mixedStart_;
|
||||
|
||||
//- Index of the start of the non-feature points
|
||||
label nonFeatureStart_;
|
||||
|
||||
//- Index of the start of the internal feature edges
|
||||
label internalStart_;
|
||||
|
||||
//- Index of the start of the flat feature edges
|
||||
label flatStart_;
|
||||
|
||||
//- Index of the start of the open feature edges
|
||||
label openStart_;
|
||||
|
||||
//- Index of the start of the multiply-connected feature edges
|
||||
label multipleStart_;
|
||||
|
||||
//- Normals of the features, to be referred to by index by both feature
|
||||
// points and edges, unsorted
|
||||
vectorField normals_;
|
||||
|
||||
//- Flat and open edges require the direction of the edge
|
||||
vectorField edgeDirections_;
|
||||
|
||||
//- Indices of the normals that are adjacent to the feature edges
|
||||
labelListList edgeNormals_;
|
||||
|
||||
//- Indices of the normals that are adjacent to the feature points
|
||||
labelListList featurePointNormals_;
|
||||
|
||||
//- Feature edges which are on the boundary between regions
|
||||
labelList regionEdges_;
|
||||
|
||||
//- Search tree for all edges
|
||||
mutable autoPtr<indexedOctree<treeDataEdge> > edgeTree_;
|
||||
|
||||
//- Individual search trees for each type of edge
|
||||
mutable PtrList<indexedOctree<treeDataEdge> > edgeTreesByType_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Classify the type of feature point. Requires valid stored member
|
||||
// data for edges and normals.
|
||||
pointStatus classifyFeaturePoint(label ptI) const;
|
||||
|
||||
//- Classify the type of feature edge. Requires face centre 0 to face
|
||||
// centre 1 vector to distinguish internal from external
|
||||
edgeStatus classifyEdge
|
||||
(
|
||||
const List<vector>& norms,
|
||||
const labelList& edNorms,
|
||||
const vector& fC0tofC1
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static data
|
||||
|
||||
//- Number of possible point types (i.e. number of slices)
|
||||
static label nPointTypes;
|
||||
|
||||
//- Number of possible feature edge types (i.e. number of slices)
|
||||
static label nEdgeTypes;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct (read) given an IOobject
|
||||
featureEdgeMesh(const IOobject&);
|
||||
|
||||
//- Construct as copy
|
||||
explicit featureEdgeMesh(const IOobject&, const featureEdgeMesh&);
|
||||
|
||||
//- Construct by transferring components (points, edges)
|
||||
//- Construct from featureEdgeMesh data
|
||||
featureEdgeMesh
|
||||
(
|
||||
const IOobject&,
|
||||
const Xfer<pointField>&,
|
||||
const Xfer<edgeList>&
|
||||
const pointField&,
|
||||
const edgeList&
|
||||
);
|
||||
|
||||
//- Construct (read) given surfaceFeatures, an objectRegistry and a
|
||||
// fileName to write to. Extracts, classifies and reorders the data
|
||||
// from surfaceFeatures.
|
||||
featureEdgeMesh
|
||||
(
|
||||
const surfaceFeatures& sFeat,
|
||||
const objectRegistry& obr,
|
||||
const fileName& sFeatFileName
|
||||
);
|
||||
|
||||
//- Construct from all components
|
||||
featureEdgeMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const pointField& pts,
|
||||
const edgeList& eds,
|
||||
label concaveStart,
|
||||
label mixedStart,
|
||||
label nonFeatureStart,
|
||||
label internalStart,
|
||||
label flatStart,
|
||||
label openStart,
|
||||
label multipleStart,
|
||||
const vectorField& normals,
|
||||
const vectorField& edgeDirections,
|
||||
const labelListList& edgeNormals,
|
||||
const labelListList& featurePointNormals,
|
||||
const labelList& regionEdges
|
||||
);
|
||||
//- Construct as copy
|
||||
featureEdgeMesh(const IOobject&, const featureEdgeMesh&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~featureEdgeMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Find
|
||||
|
||||
//- Find nearest surface edge for the sample point.
|
||||
void nearestFeatureEdge
|
||||
(
|
||||
const point& sample,
|
||||
scalar searchDistSqr,
|
||||
pointIndexHit& info
|
||||
) const;
|
||||
|
||||
//- Find nearest surface edge for each sample point.
|
||||
void nearestFeatureEdge
|
||||
(
|
||||
const pointField& samples,
|
||||
const scalarField& searchDistSqr,
|
||||
List<pointIndexHit>& info
|
||||
) const;
|
||||
|
||||
//- Find the nearest point on each type of feature edge
|
||||
void nearestFeatureEdgeByType
|
||||
(
|
||||
const point& sample,
|
||||
const scalarField& searchDistSqr,
|
||||
List<pointIndexHit>& info
|
||||
) const;
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the index of the start of the convex feature points
|
||||
inline label convexStart() const;
|
||||
|
||||
//- Return the index of the start of the concave feature points
|
||||
inline label concaveStart() const;
|
||||
|
||||
//- Return the index of the start of the mixed type feature points
|
||||
inline label mixedStart() const;
|
||||
|
||||
//- Return the index of the start of the non-feature points
|
||||
inline label nonFeatureStart() const;
|
||||
|
||||
//- Return the index of the start of the external feature edges
|
||||
inline label externalStart() const;
|
||||
|
||||
//- Return the index of the start of the internal feature edges
|
||||
inline label internalStart() const;
|
||||
|
||||
//- Return the index of the start of the flat feature edges
|
||||
inline label flatStart() const;
|
||||
|
||||
//- Return the index of the start of the open feature edges
|
||||
inline label openStart() const;
|
||||
|
||||
//- Return the index of the start of the multiply-connected feature
|
||||
// edges
|
||||
inline label multipleStart() const;
|
||||
|
||||
//- Return whether or not the point index is a feature point
|
||||
inline bool featurePoint(label ptI) const;
|
||||
|
||||
//- Return the normals of the surfaces adjacent to the feature edges
|
||||
// and points
|
||||
inline const vectorField& normals() const;
|
||||
|
||||
//- Return the edgeDirection vectors
|
||||
inline const vectorField& edgeDirections() const;
|
||||
|
||||
//- Return the direction of edgeI, pointing away from ptI
|
||||
inline vector edgeDirection(label edgeI, label ptI) const;
|
||||
|
||||
//- Return the indices of the normals that are adjacent to the
|
||||
// feature edges
|
||||
inline const labelListList& edgeNormals() const;
|
||||
|
||||
//- Return the normal vectors for a given set of normal indices
|
||||
inline vectorField edgeNormals(const labelList& edgeNormIs) const;
|
||||
|
||||
//- Return the normal vectors for a given edge
|
||||
inline vectorField edgeNormals(label edgeI) const;
|
||||
|
||||
//- Return the indices of the normals that are adjacent to the
|
||||
// feature points
|
||||
inline const labelListList& featurePointNormals() const;
|
||||
|
||||
//- Return the normal vectors for a given feature point
|
||||
inline vectorField featurePointNormals(label ptI) const;
|
||||
|
||||
//- Return the feature edges which are on the boundary between
|
||||
// regions
|
||||
inline const labelList& regionEdges() const;
|
||||
|
||||
//- Return the pointStatus of a specified point
|
||||
inline pointStatus getPointStatus(label ptI) const;
|
||||
|
||||
//- Return the edgeStatus of a specified edge
|
||||
inline edgeStatus getEdgeStatus(label edgeI) const;
|
||||
|
||||
//- Demand driven construction of octree for boundary edges
|
||||
const indexedOctree<treeDataEdge>& edgeTree() const;
|
||||
|
||||
//- Demand driven construction of octree for boundary edges by type
|
||||
const PtrList<indexedOctree<treeDataEdge> >&
|
||||
edgeTreesByType() const;
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
//- Write all components of the featureEdgeMesh as obj files
|
||||
void writeObj(const fileName& prefix) const;
|
||||
|
||||
//- Give precedence to the regIOobject write
|
||||
using regIOobject::write;
|
||||
//- ReadData function required for regIOobject read operation
|
||||
virtual bool readData(Istream&);
|
||||
|
||||
//- WriteData function required for regIOobject write operation
|
||||
virtual bool writeData(Ostream&) const;
|
||||
@ -362,10 +92,6 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "featureEdgeMeshI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user