Wrapper for position + weight to be used in e.g. averaging. More...
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 point & | second () const noexcept |
Return second. More... | |
point & | second () 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... | |
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 );
Definition at line 97 of file weightedPosition.H.
weightedPosition | ( | ) |
Construct null.
Definition at line 45 of file weightedPosition.C.
weightedPosition | ( | const scalar | s, |
const point & | p | ||
) |
Construct from components.
Definition at line 51 of file weightedPosition.C.
|
static |
Get points.
Definition at line 59 of file weightedPosition.C.
References UList< T >::first(), forAll, Foam::mag(), List< T >::setSize(), and UList< T >::size().
Referenced by snappySnapDriver::avgCellCentres().
|
static |
Set points.
Definition at line 78 of file weightedPosition.C.
References UList< T >::first(), forAll, List< T >::setSize(), and UList< T >::size().
|
static |
void operator() | ( | const vectorTensorTransform & | vt, |
const bool | forward, | ||
List< weightedPosition > & | fld | ||
) | const |
Definition at line 103 of file weightedPosition.C.
References fld().
void operator() | ( | const vectorTensorTransform & | vt, |
const bool | forward, | ||
List< List< weightedPosition > > & | flds | ||
) | const |
Definition at line 126 of file weightedPosition.C.
References fld().
void operator() | ( | const coupledPolyPatch & | cpp, |
Field< weightedPosition > & | fld | ||
) | const |
Definition at line 140 of file weightedPosition.C.
References fld().
void operator() | ( | const coupledPolyPatch & | cpp, |
Container< weightedPosition > & | map | ||
) | const |
Definition at line 34 of file weightedPositionTemplates.C.
References fld(), forAllConstIters, forAllIters, and Foam::mag().
|
static |
Synchronisation for mesh point positions.
Definition at line 155 of file weightedPosition.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld(), mesh, primitiveMesh::nPoints(), and syncTools::syncPointList().
Referenced by snappySnapDriver::avgCellCentres().
|
static |
Synchronisation for patch point positions.
Definition at line 179 of file weightedPosition.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld(), mesh, UList< T >::size(), and syncTools::syncPointList().