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 |
Access the first element. More... | |
scalar & | first () noexcept |
Access the first element. More... | |
const point & | second () const noexcept |
Access the second element. More... | |
point & | second () noexcept |
Access the second element. 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 95 of file weightedPosition.H.
weightedPosition | ( | ) |
Construct null.
Definition at line 38 of file weightedPosition.C.
weightedPosition | ( | const scalar | s, |
const point & | p | ||
) |
Construct from components.
Definition at line 44 of file weightedPosition.C.
|
static |
Get points.
Definition at line 53 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 72 of file weightedPosition.C.
References UList< T >::first(), forAll, List< T >::setSize(), and UList< T >::size().
|
static |
Summation operator.
Definition at line 86 of file weightedPosition.C.
Referenced by weightedPosition::syncPoints().
void operator() | ( | const vectorTensorTransform & | vt, |
const bool | forward, | ||
List< weightedPosition > & | fld | ||
) | const |
Definition at line 97 of file weightedPosition.C.
References fld, vectorTensorTransform::invTransformPosition(), and vectorTensorTransform::transformPosition().
void operator() | ( | const vectorTensorTransform & | vt, |
const bool | forward, | ||
List< List< weightedPosition >> & | flds | ||
) | const |
Definition at line 120 of file weightedPosition.C.
References fld.
void operator() | ( | const coupledPolyPatch & | cpp, |
Field< weightedPosition > & | fld | ||
) | const |
Definition at line 134 of file weightedPosition.C.
References fld, and coupledPolyPatch::transformPosition().
void operator() | ( | const coupledPolyPatch & | cpp, |
Container< weightedPosition > & | map | ||
) | const |
Definition at line 28 of file weightedPositionTemplates.C.
References fld, forAllConstIters(), forAllIters, Foam::mag(), and coupledPolyPatch::transformPosition().
|
static |
Synchronisation for mesh point positions.
Definition at line 149 of file weightedPosition.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld, mesh, primitiveMesh::nPoints(), weightedPosition::plusEqOp(), and syncTools::syncPointList().
Referenced by snappySnapDriver::avgCellCentres().
|
static |
Synchronisation for patch point positions.
Definition at line 173 of file weightedPosition.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld, mesh, weightedPosition::plusEqOp(), UList< T >::size(), and syncTools::syncPointList().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.