weightedPosition Class Reference

Wrapper for position + weight to be used in e.g. averaging. More...

Inheritance diagram for weightedPosition:
[legend]
Collaboration diagram for weightedPosition:
[legend]

Public Member Functions

 weightedPosition ()
 Construct null. More...
 
 weightedPosition (const scalar s, const point &p)
 Construct from components. More...
 
void operator() (const vectorTensorTransform &vt, const bool forward, List< weightedPosition > &fld) const
 
void operator() (const vectorTensorTransform &vt, const bool forward, List< List< weightedPosition >> &flds) const
 
void operator() (const coupledPolyPatch &cpp, Field< weightedPosition > &fld) const
 
template<template< class > class Container>
void operator() (const coupledPolyPatch &cpp, Container< weightedPosition > &map) const
 
- Public Member Functions inherited from Tuple2< scalar, point >
 Tuple2 ()=default
 Default construct. More...
 
 Tuple2 (const scalar &f, const point &s)
 Copy construct from components. More...
 
 Tuple2 (scalar &&f, point &&s)
 Move construct from components. More...
 
 Tuple2 (const std::pair< scalar, point > &vals)
 Copy construct from std::pair. More...
 
 Tuple2 (std::pair< scalar, point > &&vals)
 Move construct from std::pair. More...
 
 Tuple2 (Istream &is)
 Construct from Istream. More...
 
const scalar & first () const noexcept
 Return first. More...
 
scalar & first () noexcept
 Return first. More...
 
const pointsecond () const noexcept
 Return second. More...
 
pointsecond () noexcept
 Return second. More...
 

Static Public Member Functions

static void getPoints (const UList< weightedPosition > &in, List< point > &out)
 Get points. More...
 
static void setPoints (const UList< point > &in, List< weightedPosition > &out)
 Set points. More...
 
static void plusEqOp (weightedPosition &x, const weightedPosition &y)
 Summation operator. More...
 
static void syncPoints (const polyMesh &mesh, List< weightedPosition > &)
 Synchronisation for mesh point positions. More...
 
static void syncPoints (const polyMesh &mesh, const labelUList &meshPoints, List< weightedPosition > &)
 Synchronisation for patch point positions. More...
 

Additional Inherited Members

- Public Types inherited from Tuple2< scalar, point >
typedef scalar first_type
 Type of member first, the first template parameter (T1) More...
 
typedef point second_type
 Type of member second, the second template parameter (T2) More...
 

Detailed Description

Wrapper for position + weight to be used in e.g. averaging.

This avoids the problems when synchronising locations with e.g. parallel cyclics. The separation vector only applies to locations and not e.g. summed locations. Note that there is no corresponding problem for rotational cyclics.

Typical use might be to e.g. average face centres to points on a patch

const labelListList& pointFaces = pp.pointFaces(); const pointField& faceCentres = pp.faceCentres();

Field<weightedPosition> avgBoundary(pointFaces.size());

forAll(pointFaces, pointi) { const labelList& pFaces = pointFaces[pointi]; avgBoundary[pointi].first() = pFaces.size(); avgBoundary[pointi].second() = sum(pointField(faceCentres, pFaces)); } syncTools::syncPointList ( mesh, pp.meshPoints(), avgBoundary, weightedPosition::plusEqOp, // combine op pTraits<weightedPosition>::zero,// null value (not used) pTraits<weightedPosition>::zero // transform class );

Source files

Definition at line 97 of file weightedPosition.H.

Constructor & Destructor Documentation

◆ weightedPosition() [1/2]

Construct null.

Definition at line 45 of file weightedPosition.C.

◆ weightedPosition() [2/2]

weightedPosition ( const scalar  s,
const point p 
)

Construct from components.

Definition at line 51 of file weightedPosition.C.

Member Function Documentation

◆ getPoints()

void getPoints ( const UList< weightedPosition > &  in,
List< point > &  out 
)
static

Get points.

Definition at line 60 of file weightedPosition.C.

References UList< T >::first(), forAll, Foam::mag(), List< T >::setSize(), and UList< T >::size().

Referenced by snappySnapDriver::avgCellCentres().

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

◆ setPoints()

void setPoints ( const UList< point > &  in,
List< weightedPosition > &  out 
)
static

Set points.

Definition at line 79 of file weightedPosition.C.

References forAll, List< T >::setSize(), and UList< T >::size().

Here is the call graph for this function:

◆ plusEqOp()

void plusEqOp ( weightedPosition x,
const weightedPosition y 
)
static

Summation operator.

Definition at line 93 of file weightedPosition.C.

References x, and y.

Referenced by weightedPosition::syncPoints().

Here is the caller graph for this function:

◆ operator()() [1/4]

void operator() ( const vectorTensorTransform vt,
const bool  forward,
List< weightedPosition > &  fld 
) const

Definition at line 104 of file weightedPosition.C.

References fld, vectorTensorTransform::invTransformPosition(), and vectorTensorTransform::transformPosition().

Here is the call graph for this function:

◆ operator()() [2/4]

void operator() ( const vectorTensorTransform vt,
const bool  forward,
List< List< weightedPosition >> &  flds 
) const

Definition at line 127 of file weightedPosition.C.

References fld.

◆ operator()() [3/4]

void operator() ( const coupledPolyPatch cpp,
Field< weightedPosition > &  fld 
) const

Definition at line 141 of file weightedPosition.C.

References fld, and coupledPolyPatch::transformPosition().

Here is the call graph for this function:

◆ operator()() [4/4]

void operator() ( const coupledPolyPatch cpp,
Container< weightedPosition > &  map 
) const

Definition at line 35 of file weightedPositionTemplates.C.

References fld, forAllConstIters(), forAllIters, Foam::mag(), and coupledPolyPatch::transformPosition().

Here is the call graph for this function:

◆ syncPoints() [1/2]

void syncPoints ( const polyMesh mesh,
List< weightedPosition > &  fld 
)
static

Synchronisation for mesh point positions.

Definition at line 156 of file weightedPosition.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld, mesh, primitiveMesh::nPoints(), weightedPosition::plusEqOp(), and syncTools::syncPointList().

Referenced by snappySnapDriver::avgCellCentres().

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

◆ syncPoints() [2/2]

void syncPoints ( const polyMesh mesh,
const labelUList meshPoints,
List< weightedPosition > &  fld 
)
static

Synchronisation for patch point positions.

Definition at line 180 of file weightedPosition.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld, mesh, weightedPosition::plusEqOp(), UList< T >::size(), and syncTools::syncPointList().

Here is the call graph for this function:

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