Foam::cutPoly Namespace Reference

Low level functions for cutting poly faces and cells. More...

Classes

struct  OpBegin
 
struct  OpDereference
 
struct  OpNext
 
struct  OpScaled
 
struct  InPlaceOpAdvance
 
struct  BinaryOpAdd
 
class  FaceCutValues
 
class  CellCutValues
 

Functions

List< labelPairfaceCuts (const face &f, const scalarField &pAlphas, const scalar isoAlpha)
 Return the cuts for a given face. This returns a list of pairs of. More...
 
labelListList cellCuts (const cell &c, const cellEdgeAddressing &cAddr, const faceUList &fs, const List< List< labelPair >> &fCuts, const scalarField &pAlphas, const scalar isoAlpha)
 Return the cuts for a given cell. This returns a list of lists of cell-edge. More...
 
void writeFaceCuts (const face &f, const List< labelPair > &fCuts, const pointField &ps, const scalarField &pAlphas, const scalar isoAlpha, OBJstream &obj)
 Write the cuts for a given face to an OBJ file. More...
 
void writeCellCuts (const cell &c, const cellEdgeAddressing &cAddr, const List< List< label >> &cCuts, const faceList &fs, const pointField &ps, const scalarField &pAlphas, const scalar isoAlpha, OBJstream &obj)
 Write the cuts for a given cell to an OBJ file. More...
 
template<template< class > class FaceValues, class ... Types>
std::tuple< vector, typename outerProduct< vector, Types >::type ... > faceAreaIntegral (const FaceValues< point > &fPs, const point &fPAvg, const std::tuple< FaceValues< Types > ... > &fPsis, const std::tuple< Types ... > &fPsiAvg)
 Compute the face-area and face-area-integrals of the given properties over. More...
 
template<class Type >
Tuple2< vector, typename outerProduct< vector, Type >::typefaceCutAreaIntegral (const face &f, const vector &fArea, const Type &fPsi, const List< labelPair > &fCuts, const pointField &ps, const Field< Type > &pPsis, const scalarField &pAlphas, const scalar isoAlpha, const bool below)
 Compute the face-area and face-area-integral of the given property over. More...
 
template<class Type >
Tuple2< scalar, Type > cellCutVolumeIntegral (const cell &c, const cellEdgeAddressing &cAddr, const scalar cVolume, const Type &cPsi, const labelListList &cCuts, const faceUList &fs, const vectorField &fAreas, const vectorField &fCentres, const vectorField &fPsis, const vectorField &fCutAreas, const vectorField &fCutPsis, const pointField &ps, const Field< Type > &pPsis, const scalarField &pAlphas, const scalar isoAlpha, const bool below)
 Compute the cell-volume and cell-volume-integral of the given property over. More...
 
template<class Type >
Type average (const UIndirectList< Type > &l)
 
template<class Type >
Type average (const List< Type > &xs, const labelUList &is)
 
template<class Container >
Container::value_type iterableAverage (const Container &xs)
 
template<class Op , class Tuple , class Int , Int ... Is>
auto tupleOp (const Tuple &tuple, const std::integer_sequence< Int, Is ... > &, const Op &op)
 
template<class Op , class ... Types>
auto tupleOp (const std::tuple< Types... > &tuple, const Op &op)
 
template<class Op , class Tuple , class Int , Int ... Is>
void tupleInPlaceOp (Tuple &tuple, const std::integer_sequence< Int, Is ... > &, const Op &op)
 
template<class Op , class ... Types>
void tupleInPlaceOp (std::tuple< Types... > &tuple, const Op &op)
 
template<class BinaryOp , class Tuple , class Int , Int ... Is>
auto tupleBinaryOp (const Tuple &tupleA, const Tuple &tupleB, const std::integer_sequence< Int, Is ... > &, const BinaryOp &bop)
 
template<class BinaryOp , class ... TypesA, class ... TypesB>
auto tupleBinaryOp (const std::tuple< TypesA ... > &tupleA, const std::tuple< TypesB ... > &tupleB, const BinaryOp &bop)
 
scalar edgeCutLambda (const edge &e, const scalarField &pAlphas, const scalar isoAlpha)
 Get the local coordinate within an edge, given end point values and an. More...
 
template<class Type >
Type edgeCutValue (const edge &e, const scalar lambda, const Field< Type > &pPsis)
 Linearly interpolate a value from the end points to the cut point of an. More...
 
template<class Type >
Type edgeCutValue (const edge &e, const scalarField &pAlphas, const scalar isoAlpha, const Field< Type > &pPsis)
 Linearly interpolate a value from the end points to the cut point of an. More...
 

Variables

static const bool separatedBelow = true
 This flag determines which side of the iso-surface is separated into. More...
 

Detailed Description

Low level functions for cutting poly faces and cells.

Functions and classes for extracting values from cut edges, faces and cells.

Functions for computing integrals over cut faces and cells.

Cutting a face using an iso-surface defined at the points is done by walking around the face. A start point is chosen and then the walk proceeds until a "cut" edge is found with points on either side of the iso-surface. This edge is noted and the walk continues until another cut edge is found. These two edge cuts, along with all points in-between, form a sub-face on one side of the iso-surface. This algorithm continues around the entire face, potentially cutting off multiple sub-faces. The remainder is a single contiguous face on the other side of the iso-surface.

Cutting a cell is then done by walking from cut-edge to cut-edge around the cell's faces.

Source files

Source files

Source files

Function Documentation

◆ faceCuts()

Foam::List< Foam::labelPair > faceCuts ( const face f,
const scalarField pAlphas,
const scalar  isoAlpha 
)

Return the cuts for a given face. This returns a list of pairs of.

face-edge indices. Both edges in the pair are cut, and connecting these cuts creates an edge of the iso-surface.

Definition at line 60 of file cutPoly.C.

References DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), Foam::exit(), f(), Foam::FatalError, FatalErrorInFunction, forAll, UList< T >::last(), Foam::max(), Foam::min(), separatedBelow, and DynamicList< T, SizeInc, SizeMult, SizeDiv >::shrink().

Referenced by cutPolyIsoSurface::cutPolyIsoSurface().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cellCuts()

Foam::labelListList cellCuts ( const cell c,
const cellEdgeAddressing cAddr,
const faceUList fs,
const List< List< labelPair >> &  fCuts,
const scalarField pAlphas,
const scalar  isoAlpha 
)

Return the cuts for a given cell. This returns a list of lists of cell-edge.

indices. Each sub-list represents a single closed loop of cell-edges. The edges listed are all cut, and connecting these cuts up creates a face of the iso-surface.

Definition at line 120 of file cutPoly.C.

References DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), Foam::constant::universal::c, cellEdgeAddressing::ceiToCfiAndFei(), cellEdgeAddressing::cfiAndFeiToCei(), cellEdgeAddressing::cOwns(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Pair< Type >::first(), forAll, found, UList< T >::last(), Pair< Type >::second(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::shrink(), and UList< T >::size().

Referenced by cutPolyIsoSurface::cutPolyIsoSurface().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeFaceCuts()

void writeFaceCuts ( const face f,
const List< labelPair > &  fCuts,
const pointField ps,
const scalarField pAlphas,
const scalar  isoAlpha,
OBJstream obj 
)

Write the cuts for a given face to an OBJ file.

Definition at line 244 of file cutPoly.C.

References Foam::constant::electromagnetic::e, edgeCutValue(), f(), forAll, and OBJstream::write().

Here is the call graph for this function:

◆ writeCellCuts()

void writeCellCuts ( const cell c,
const cellEdgeAddressing cAddr,
const List< List< label >> &  cCuts,
const faceList fs,
const pointField ps,
const scalarField pAlphas,
const scalar  isoAlpha,
OBJstream obj 
)

Write the cuts for a given cell to an OBJ file.

Definition at line 270 of file cutPoly.C.

References Foam::constant::universal::c, cellEdgeAddressing::ceiToCfiAndFei(), Foam::constant::electromagnetic::e, edgeCutValue(), forAll, Foam::identityMap(), and OBJstream::write().

Here is the call graph for this function:

◆ faceAreaIntegral()

std::tuple<vector, typename outerProduct<vector, Types>::type ...> Foam::cutPoly::faceAreaIntegral ( const FaceValues< point > &  fPs,
const point fPAvg,
const std::tuple< FaceValues< Types > ... > &  fPsis,
const std::tuple< Types ... > &  fPsiAvg 
)

Compute the face-area and face-area-integrals of the given properties over.

a face

◆ faceCutAreaIntegral()

Tuple2<vector, typename outerProduct<vector, Type>::type> Foam::cutPoly::faceCutAreaIntegral ( const face f,
const vector fArea,
const Type &  fPsi,
const List< labelPair > &  fCuts,
const pointField ps,
const Field< Type > &  pPsis,
const scalarField pAlphas,
const scalar  isoAlpha,
const bool  below 
)

Compute the face-area and face-area-integral of the given property over.

a cut-face. ToDo: Make variadic as faceAreaIntegral.

◆ cellCutVolumeIntegral()

Tuple2<scalar, Type> Foam::cutPoly::cellCutVolumeIntegral ( const cell c,
const cellEdgeAddressing cAddr,
const scalar  cVolume,
const Type &  cPsi,
const labelListList cCuts,
const faceUList fs,
const vectorField fAreas,
const vectorField fCentres,
const vectorField fPsis,
const vectorField fCutAreas,
const vectorField fCutPsis,
const pointField ps,
const Field< Type > &  pPsis,
const scalarField pAlphas,
const scalar  isoAlpha,
const bool  below 
)

Compute the cell-volume and cell-volume-integral of the given property over.

a cut-cell. ToDo: Make variadic as faceAreaIntegral.

◆ average() [1/2]

Type Foam::cutPoly::average ( const UIndirectList< Type > &  l)

Definition at line 36 of file cutPolyIntegralTemplates.C.

References forAll, and UIndirectList< T >::size().

Referenced by average().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ average() [2/2]

Type Foam::cutPoly::average ( const List< Type > &  xs,
const labelUList is 
)

Definition at line 47 of file cutPolyIntegralTemplates.C.

References average().

Here is the call graph for this function:

◆ iterableAverage()

Container::value_type Foam::cutPoly::iterableAverage ( const Container &  xs)

Definition at line 53 of file cutPolyIntegralTemplates.C.

References forAllConstIter, and n.

◆ tupleOp() [1/2]

auto Foam::cutPoly::tupleOp ( const Tuple &  tuple,
const std::integer_sequence< Int, Is ... > &  ,
const Op op 
)

Definition at line 79 of file cutPolyIntegralTemplates.C.

Referenced by tupleOp().

Here is the caller graph for this function:

◆ tupleOp() [2/2]

auto Foam::cutPoly::tupleOp ( const std::tuple< Types... > &  tuple,
const Op op 
)

Definition at line 91 of file cutPolyIntegralTemplates.C.

References tupleOp().

Here is the call graph for this function:

◆ tupleInPlaceOp() [1/2]

void Foam::cutPoly::tupleInPlaceOp ( Tuple &  tuple,
const std::integer_sequence< Int, Is ... > &  ,
const Op op 
)

Definition at line 146 of file cutPolyIntegralTemplates.C.

Referenced by tupleInPlaceOp().

Here is the caller graph for this function:

◆ tupleInPlaceOp() [2/2]

void Foam::cutPoly::tupleInPlaceOp ( std::tuple< Types... > &  tuple,
const Op op 
)

Definition at line 162 of file cutPolyIntegralTemplates.C.

References tupleInPlaceOp().

Here is the call graph for this function:

◆ tupleBinaryOp() [1/2]

auto Foam::cutPoly::tupleBinaryOp ( const Tuple &  tupleA,
const Tuple &  tupleB,
const std::integer_sequence< Int, Is ... > &  ,
const BinaryOp &  bop 
)

Definition at line 179 of file cutPolyIntegralTemplates.C.

Referenced by tupleBinaryOp().

Here is the caller graph for this function:

◆ tupleBinaryOp() [2/2]

auto Foam::cutPoly::tupleBinaryOp ( const std::tuple< TypesA ... > &  tupleA,
const std::tuple< TypesB ... > &  tupleB,
const BinaryOp &  bop 
)

Definition at line 192 of file cutPolyIntegralTemplates.C.

References tupleBinaryOp().

Here is the call graph for this function:

◆ edgeCutLambda()

Foam::scalar edgeCutLambda ( const edge e,
const scalarField pAlphas,
const scalar  isoAlpha 
)
inline

Get the local coordinate within an edge, given end point values and an.

iso-value

Definition at line 30 of file cutPolyValueI.H.

References Foam::constant::electromagnetic::e.

Referenced by cutPolyIsoSurface::cutPolyIsoSurface(), and edgeCutValue().

Here is the caller graph for this function:

◆ edgeCutValue() [1/2]

Type edgeCutValue ( const edge e,
const scalar  lambda,
const Field< Type > &  pPsis 
)

Linearly interpolate a value from the end points to the cut point of an.

edge, given a local coordinate within the edge

Definition at line 31 of file cutPolyValueTemplates.C.

References Foam::constant::electromagnetic::e, and lambda().

Referenced by cutPolyIsoSurface::cutPolyIsoSurface(), edgeCutValue(), cutPolyIsoSurface::interpolate(), writeCellCuts(), and writeFaceCuts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ edgeCutValue() [2/2]

Type edgeCutValue ( const edge e,
const scalarField pAlphas,
const scalar  isoAlpha,
const Field< Type > &  pPsis 
)

Linearly interpolate a value from the end points to the cut point of an.

edge, given end point values and an iso-value

Definition at line 43 of file cutPolyValueTemplates.C.

References Foam::constant::electromagnetic::e, edgeCutLambda(), and edgeCutValue().

Here is the call graph for this function:

Variable Documentation

◆ separatedBelow

const bool separatedBelow = true
static

This flag determines which side of the iso-surface is separated into.

multiple sub-faces, and which side is kept as the central contiguous face

Definition at line 65 of file cutPoly.H.

Referenced by faceCuts(), and FaceCutValues< Type >::const_iterator::next().