Loading...
Searching...
No Matches
weightedPosition Class Reference

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

#include <weightedPosition.H>

Inheritance diagram for weightedPosition:
Collaboration diagram for weightedPosition:

Public Member Functions

 weightedPosition ()
 Construct null.
 weightedPosition (const scalar s, const point &p)
 Construct from components.
void operator() (const vectorTensorTransform &vt, const bool forward, UList< 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.
const scalar & first () const noexcept
 Access the first element.
const pointsecond () const noexcept
 Access the second element.

Static Public Member Functions

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

Additional Inherited Members

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

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 vectorField::subField 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 95 of file weightedPosition.H.

Constructor & Destructor Documentation

◆ weightedPosition() [1/2]

weightedPosition ( )

Construct null.

Definition at line 38 of file weightedPosition.C.

References Tuple2< scalar, point >::Tuple2().

Referenced by plusEqOp().

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

◆ weightedPosition() [2/2]

weightedPosition ( const scalar s,
const point & p )

Construct from components.

Definition at line 44 of file weightedPosition.C.

References p, s(), and Tuple2< scalar, point >::Tuple2().

Here is the call graph for this function:

Member Function Documentation

◆ getPoints()

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

Get points.

Definition at line 52 of file weightedPosition.C.

References Tuple2< scalar, point >::first(), UList< T >::first(), forAll, Foam::mag(), List< T >::resize_nocopy(), and UList< T >::size().

Referenced by snappySnapDriver::avgCellCentres(), operator()(), and operator()().

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

◆ setPoints()

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

Set points.

Definition at line 71 of file weightedPosition.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, UList< T >::first(), Foam::min(), and UList< T >::size().

Referenced by operator()(), and operator()().

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

◆ plusEqOp()

void plusEqOp ( weightedPosition & x,
const weightedPosition & y )
static

Summation operator.

Definition at line 98 of file weightedPosition.C.

References weightedPosition(), x, and y.

Referenced by syncPoints(), and syncPoints().

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

◆ operator()() [1/4]

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

Definition at line 109 of file weightedPosition.C.

References fld(), getPoints(), and setPoints().

Referenced by operator()().

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

◆ operator()() [2/4]

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

Definition at line 132 of file weightedPosition.C.

References fld(), and operator()().

Here is the call graph for this function:

◆ operator()() [3/4]

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

Definition at line 146 of file weightedPosition.C.

References fld(), getPoints(), and setPoints().

Here is the call graph for this function:

◆ operator()() [4/4]

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

Definition at line 27 of file weightedPositionTemplates.C.

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

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 161 of file weightedPosition.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld(), mesh, 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 185 of file weightedPosition.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld(), mesh, 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: