Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
cuttingPlane Class Reference

Constructs plane through mesh. More...

Inheritance diagram for cuttingPlane:
Inheritance graph
[legend]
Collaboration diagram for cuttingPlane:
Collaboration graph
[legend]

Public Member Functions

 cuttingPlane (const plane &, const primitiveMesh &, const bool triangulate, const labelUList &cellIdLabels=labelUList::null())
 Construct from plane and mesh reference,. More...
 
const planeplaneDesc () const
 Return plane used. More...
 
const labelListcutCells () const
 Return List of cells cut by the plane. More...
 
bool cut () const
 Return true or false to question: have any cells been cut? More...
 
template<class Type >
tmp< Field< Type > > sample (const Field< Type > &) const
 Sample the cell field. More...
 
template<class Type >
tmp< Field< Type > > sample (const tmp< Field< Type > > &) const
 
void operator= (const cuttingPlane &)
 
template<class Type >
Foam::tmp< Foam::Field< Type > > sample (const Field< Type > &fld) const
 
template<class Type >
Foam::tmp< Foam::Field< Type > > sample (const tmp< Field< Type > > &tfld) const
 
- Public Member Functions inherited from plane
 plane (const vector &normalVector)
 Construct from normal vector through the origin. More...
 
 plane (const point &basePoint, const vector &normalVector)
 Construct from normal vector and point in plane. More...
 
 plane (const point &point1, const point &point2, const point &point3)
 Construct from three points in plane. More...
 
 plane (const scalarList &C)
 Construct from coefficients for the. More...
 
 plane (const dictionary &planeDict)
 Construct from dictionary. More...
 
 plane (Istream &is)
 Construct from Istream. Assumes the base + normal notation. More...
 
const vectornormal () const
 Return plane normal. More...
 
const pointrefPoint () const
 Return or return plane base point. More...
 
FixedList< scalar, 4 > planeCoeffs () const
 Return coefficients for the. More...
 
point nearestPoint (const point &p) const
 Return nearest point in the plane for the given point. More...
 
scalar distance (const point &p) const
 Return distance from the given point to the plane. More...
 
scalar normalIntersect (const point &pnt0, const vector &dir) const
 Return cut coefficient for plane and line defined by. More...
 
scalar normalIntersect (const ray &r) const
 Return cut coefficient for plane and ray. More...
 
template<class Point , class PointRef >
scalar lineIntersect (const line< Point, PointRef > &l) const
 Return the cutting point between the plane and. More...
 
ray planeIntersect (const plane &) const
 Return the cutting line between this plane and another. More...
 
point planePlaneIntersect (const plane &, const plane &) const
 Return the cutting point between this plane and two other planes. More...
 
side sideOfPlane (const point &p) const
 Return the side of the plane that the point is on. More...
 
point mirror (const point &p) const
 Mirror the supplied point in the plane. Return the mirrored point. More...
 
void writeDict (Ostream &) const
 Write to dictionary. More...
 
- Public Member Functions inherited from MeshedSurface< face >
 MeshedSurface ()
 Construct null. More...
 
 MeshedSurface (const Xfer< pointField > &, const Xfer< List< Face > > &, const Xfer< surfZoneList > &)
 Construct by transferring components (points, faces, zones). More...
 
 MeshedSurface (const Xfer< pointField > &, const Xfer< List< Face > > &, const labelUList &zoneSizes=labelUList(), const UList< word > &zoneNames=UList< word >())
 Construct by transferring components (points, faces). More...
 
 MeshedSurface (const MeshedSurface &)
 Construct as copy. More...
 
 MeshedSurface (const UnsortedMeshedSurface< Face > &)
 Construct from a UnsortedMeshedSurface. More...
 
 MeshedSurface (const polyBoundaryMesh &, const bool globalPoints=false)
 Construct from a boundary mesh with local points/faces. More...
 
 MeshedSurface (const surfMesh &)
 Construct from a surfMesh. More...
 
 MeshedSurface (const Xfer< UnsortedMeshedSurface< Face > > &)
 Construct by transferring the contents from a UnsortedMeshedSurface. More...
 
 MeshedSurface (const Xfer< MeshedSurface< Face > > &)
 Construct by transferring the contents from a MeshedSurface. More...
 
 MeshedSurface (const fileName &)
 Construct from file name (uses extension to determine type) More...
 
 MeshedSurface (const fileName &, const word &ext)
 Construct from file name (uses extension to determine type) More...
 
 MeshedSurface (const Time &, const word &surfName="")
 Construct from database. More...
 
 MeshedSurface ()
 
 MeshedSurface (const Xfer< pointField > &pointLst, const Xfer< List< Face > > &faceLst, const Xfer< surfZoneList > &zoneLst)
 
 MeshedSurface (const Xfer< pointField > &pointLst, const Xfer< List< Face > > &faceLst, const labelUList &zoneSizes, const UList< word > &zoneNames)
 
 MeshedSurface (const MeshedSurface< Face > &surf)
 
 MeshedSurface (const UnsortedMeshedSurface< Face > &surf)
 
 MeshedSurface (const surfMesh &mesh)
 
 MeshedSurface (const polyBoundaryMesh &bMesh, const bool useGlobalPoints)
 
 MeshedSurface (const fileName &name, const word &ext)
 
 MeshedSurface (const fileName &name)
 
 MeshedSurface (const Time &t, const word &surfName)
 
 MeshedSurface (const Xfer< UnsortedMeshedSurface< Face > > &surf)
 
 MeshedSurface (const Xfer< MeshedSurface< Face > > &surf)
 
 ClassName ("MeshedSurface")
 Runtime type information. More...
 
bool isTri ()
 Specialization for holding triangulated information. More...
 
 declareRunTimeSelectionTable (autoPtr, MeshedSurface, fileExtension,(const fileName &name),(name))
 
virtual ~MeshedSurface ()
 Destructor. More...
 
 declareMemberFunctionSelectionTable (void, UnsortedMeshedSurface, write, fileExtension,(const fileName &name, const MeshedSurface< Face > &surf),(name, surf))
 
virtual void write (const fileName &name) const
 Generic write routine. Chooses writer based on extension. More...
 
void write (const Time &, const word &surfName="") const
 Write to database. More...
 
label size () const
 The surface size is the number of faces. More...
 
const List< Face > & faces () const
 Return const access to the faces. More...
 
const List< surfZone > & surfZones () const
 Const access to the surface zones. More...
 
virtual void addZones (const UList< surfZone > &, const bool cullEmpty=false)
 Add surface zones. More...
 
virtual void addZones (const labelUList &sizes, const UList< word > &names, const bool cullEmpty=false)
 Add surface zones. More...
 
virtual void addZones (const labelUList &sizes, const bool cullEmpty=false)
 Add surface zones. More...
 
virtual void removeZones ()
 Remove surface zones. More...
 
virtual void clear ()
 Clear all storage. More...
 
virtual void movePoints (const pointField &)
 Move points. More...
 
virtual void scalePoints (const scalar)
 Scale points. A non-positive factor is ignored. More...
 
virtual void reset (const Xfer< pointField > &points, const Xfer< List< Face > > &faces, const Xfer< surfZoneList > &zones)
 Reset primitive data (points, faces and zones) More...
 
virtual void reset (const Xfer< List< point > > &points, const Xfer< List< Face > > &faces, const Xfer< surfZoneList > &zones)
 Reset primitive data (points, faces and zones) More...
 
virtual void cleanup (const bool verbose)
 Remove invalid faces. More...
 
virtual bool stitchFaces (const scalar tol=SMALL, const bool verbose=false)
 
virtual bool checkFaces (const bool verbose=false)
 
virtual label triangulate ()
 Triangulate in-place, returning the number of triangles added. More...
 
virtual label triangulate (List< label > &faceMap)
 Triangulate in-place, returning the number of triangles added. More...
 
label triangulate ()
 Specialization for holding triangulated information. More...
 
label triangulate (List< label > &faceMap)
 Specialization for holding triangulated information. More...
 
MeshedSurface subsetMesh (const labelHashSet &include, labelList &pointMap, labelList &faceMap) const
 Return new surface. More...
 
MeshedSurface subsetMesh (const labelHashSet &include) const
 Return new surface. More...
 
void transfer (MeshedSurface< Face > &)
 Transfer the contents of the argument and annul the argument. More...
 
void transfer (UnsortedMeshedSurface< Face > &)
 Transfer the contents of the argument and annul the argument. More...
 
Xfer< MeshedSurface< Face > > xfer ()
 Transfer contents to the Xfer container. More...
 
bool read (const fileName &, const word &ext)
 Read from file. Chooses reader based on explicit extension. More...
 
virtual bool read (const fileName &)
 Read from file. Chooses reader based on detected extension. More...
 
void writeStats (Ostream &os) const
 
void operator= (const MeshedSurface< Face > &)
 
 operator MeshedSurfaceProxy< Face > () const
 Conversion operator to MeshedSurfaceProxy. More...
 

Protected Member Functions

 cuttingPlane (const plane &)
 Construct plane description without cutting. More...
 
void reCut (const primitiveMesh &, const bool triangulate, const labelUList &cellIdLabels=labelUList::null())
 Recut mesh with existing planeDesc, restricted to a list of cells. More...
 
virtual void remapFaces (const labelUList &faceMap)
 Remap action on triangulation or cleanup. More...
 
- Protected Member Functions inherited from MeshedSurface< face >
void transcribe (MeshedSurface< face > &)
 Transfer points/zones and transcribe face -> triFace. More...
 
void transcribe (MeshedSurface< face > &surf)
 
void transcribe (MeshedSurface< face > &surf)
 
void checkZones ()
 Basic sanity check on zones. More...
 
pointFieldstoredPoints ()
 Non-const access to global points. More...
 
List< Face > & storedFaces ()
 Non-const access to the faces. More...
 
surfZoneListstoredZones ()
 Non-const access to the zones. More...
 
void sortFacesAndStore (const Xfer< List< Face > > &unsortedFaces, const Xfer< List< label > > &zoneIds, const bool sorted)
 Sort faces by zones and store sorted faces. More...
 

Private Types

typedef MeshedSurface< faceMeshStorage
 Private typedef for convenience. More...
 

Private Member Functions

void calcCutCells (const primitiveMesh &, const scalarField &dotProducts, const labelUList &cellIdLabels=labelUList::null())
 Determine cut cells, possibly restricted to a list of cells. More...
 
void intersectEdges (const primitiveMesh &, const scalarField &dotProducts, List< label > &edgePoint)
 Determine intersection points (cutPoints). More...
 
void walkCellCuts (const primitiveMesh &mesh, const bool triangulate, const labelUList &edgePoint)
 Determine cuts for all cut cells. More...
 

Static Private Member Functions

static bool walkCell (const primitiveMesh &, const labelUList &edgePoint, const label cellI, const label startEdgeI, DynamicList< label > &faceVerts)
 Walk circumference of cell, starting from startEdgeI crossing. More...
 

Private Attributes

labelList cutCells_
 List of cells cut by the plane. More...
 

Additional Inherited Members

- Public Types inherited from plane
enum  side { NORMAL, FLIP }
 Side of the plane. More...
 
- Public Types inherited from MeshedSurface< face >
typedef Face FaceType
 Face type used. More...
 
- Static Public Member Functions inherited from MeshedSurface< face >
static bool isTri ()
 Face storage only handles triangulated faces. More...
 
static bool canRead (const fileName &, const bool verbose=false)
 Can we read this file format? More...
 
static bool canReadType (const word &ext, const bool verbose=false)
 Can we read this file format? More...
 
static bool canWriteType (const word &ext, const bool verbose=false)
 Can we write this file format? More...
 
static wordHashSet readTypes ()
 
static wordHashSet writeTypes ()
 
static autoPtr< MeshedSurfaceNew (const fileName &, const word &ext)
 Select constructed from filename (explicit extension) More...
 
static autoPtr< MeshedSurfaceNew (const fileName &)
 Select constructed from filename (implicit extension) More...
 
static void write (const fileName &, const MeshedSurface< Face > &)
 Write to file. More...
 

Detailed Description

Constructs plane through mesh.

No attempt at resolving degenerate cases. Since the cut faces are usually quite ugly, they will always be triangulated.

Note
When the cutting plane coincides with a mesh face, the cell edge on the positive side of the plane is taken.
Source files

Definition at line 60 of file cuttingPlane.H.

Member Typedef Documentation

◆ MeshStorage

typedef MeshedSurface<face> MeshStorage
private

Private typedef for convenience.

Definition at line 66 of file cuttingPlane.H.

Constructor & Destructor Documentation

◆ cuttingPlane() [1/2]

cuttingPlane ( const plane pln)
protected

Construct plane description without cutting.

Definition at line 340 of file cuttingPlane.C.

◆ cuttingPlane() [2/2]

cuttingPlane ( const plane pln,
const primitiveMesh mesh,
const bool  triangulate,
const labelUList cellIdLabels = labelUList::null() 
)

Construct from plane and mesh reference,.

possibly restricted to a list of cells

Definition at line 348 of file cuttingPlane.C.

References mesh.

Member Function Documentation

◆ calcCutCells()

void calcCutCells ( const primitiveMesh mesh,
const scalarField dotProducts,
const labelUList cellIdLabels = labelUList::null() 
)
private

Determine cut cells, possibly restricted to a list of cells.

Definition at line 43 of file cuttingPlane.C.

References Foam::constant::electromagnetic::e, forAll, mesh, Foam::notNull(), List::setSize(), List::size(), and UList::size().

Here is the call graph for this function:

◆ intersectEdges()

void intersectEdges ( const primitiveMesh mesh,
const scalarField dotProducts,
List< label > &  edgePoint 
)
private

Determine intersection points (cutPoints).

Definition at line 104 of file cuttingPlane.C.

References Foam::constant::atomic::alpha, DynamicList::append(), Foam::constant::electromagnetic::e, forAll, mesh, points, List::setSize(), List::size(), and List::transfer().

Here is the call graph for this function:

◆ walkCell()

bool walkCell ( const primitiveMesh mesh,
const labelUList edgePoint,
const label  cellI,
const label  startEdgeI,
DynamicList< label > &  faceVerts 
)
staticprivate

Walk circumference of cell, starting from startEdgeI crossing.

only cut edges. Record cutPoint labels in faceVerts.

Definition at line 161 of file cuttingPlane.C.

References DynamicList::append(), DynamicList::clear(), Foam::endl(), forAll, mesh, Foam::nl, Foam::meshTools::otherFace(), and WarningInFunction.

Here is the call graph for this function:

◆ walkCellCuts()

void walkCellCuts ( const primitiveMesh mesh,
const bool  triangulate,
const labelUList edgePoint 
)
private

Determine cuts for all cut cells.

Definition at line 252 of file cuttingPlane.C.

References Foam::abort(), DynamicList::append(), f(), Foam::FatalError, FatalErrorInFunction, forAll, mesh, and points.

Here is the call graph for this function:

◆ reCut()

void reCut ( const primitiveMesh mesh,
const bool  triangulate,
const labelUList cellIdLabels = labelUList::null() 
)
protected

Recut mesh with existing planeDesc, restricted to a list of cells.

Definition at line 365 of file cuttingPlane.C.

References clear(), mesh, and polyMesh::points().

Here is the call graph for this function:

◆ remapFaces()

void remapFaces ( const labelUList faceMap)
protectedvirtual

Remap action on triangulation or cleanup.

Reimplemented from MeshedSurface< face >.

Definition at line 390 of file cuttingPlane.C.

References Foam::faceMap(), forAll, Foam::notNull(), and List::transfer().

Here is the call graph for this function:

◆ planeDesc()

const plane& planeDesc ( ) const
inline

Return plane used.

Definition at line 152 of file cuttingPlane.H.

◆ cutCells()

const labelList& cutCells ( ) const
inline

Return List of cells cut by the plane.

Definition at line 158 of file cuttingPlane.H.

References cuttingPlane::cutCells_.

Referenced by sampledPlane::meshCells(), and cuttingPlane::operator=().

Here is the caller graph for this function:

◆ cut()

bool cut ( ) const
inline

Return true or false to question: have any cells been cut?

Definition at line 164 of file cuttingPlane.H.

References cuttingPlane::cutCells_, and List::size().

Here is the call graph for this function:

◆ sample() [1/4]

tmp<Field<Type> > sample ( const Field< Type > &  ) const

Sample the cell field.

◆ sample() [2/4]

tmp<Field<Type> > sample ( const tmp< Field< Type > > &  ) const

◆ operator=()

void operator= ( const cuttingPlane rhs)

Definition at line 411 of file cuttingPlane.C.

References Foam::abort(), cuttingPlane::cutCells(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ sample() [3/4]

Foam::tmp<Foam::Field<Type> > sample ( const Field< Type > &  fld) const

Definition at line 37 of file cuttingPlaneTemplates.C.

References fld().

Here is the call graph for this function:

◆ sample() [4/4]

Foam::tmp<Foam::Field<Type> > sample ( const tmp< Field< Type > > &  tfld) const

Definition at line 47 of file cuttingPlaneTemplates.C.

Field Documentation

◆ cutCells_

labelList cutCells_
private

List of cells cut by the plane.

Definition at line 72 of file cuttingPlane.H.

Referenced by cuttingPlane::cut(), and cuttingPlane::cutCells().


The documentation for this class was generated from the following files: