68 out[i] = in[i].second();
70 if (
mag(in[i].first()) > VSMALL)
72 out[i] /= in[i].
first();
85 if (in.size() != out.size())
88 <<
"Mismatch in size. Number of points:" << in.size()
89 <<
" != number of weighted positions:" << out.size()
93 const label len = out.
size();
95 const label len =
Foam::min(in.size(), out.size());
98 for (label i = 0; i < len; ++i)
100 out[i].second() = out[i].first()*in[i];
108 const weightedPosition&
y
111 x.first() +=
y.first();
112 x.second() +=
y.second();
116void Foam::weightedPosition::operator()
124 getPoints(
fld, pfld);
128 vt.transformPositionList(pfld);
132 vt.invTransformPositionList(pfld);
135 setPoints(pfld,
fld);
139void Foam::weightedPosition::operator()
141 const vectorTensorTransform& vt,
143 List<List<weightedPosition>>& flds
153void Foam::weightedPosition::operator()
155 const coupledPolyPatch& cpp,
156 Field<weightedPosition>&
fld
160 getPoints(
fld, pfld);
162 cpp.transformPosition(pfld);
174 if (
fld.size() !=
mesh.nPoints())
177 <<
" does not correspond to the number of points in the mesh "
199 if (
fld.size() != meshPoints.
size())
202 <<
" does not correspond to the number of points supplied "
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
const scalar & first() const noexcept
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
T & first()
Access first element of the list, position [0].
void size(const label n)
Older name for setAddressableSize.
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
static const weightedPosition zero
A traits class, which is primarily used for primitives and vector-space.
Mesh consisting of general polyhedral cells.
Wrapper for position + weight to be used in e.g. averaging.
static void getPoints(const UList< weightedPosition > &in, List< point > &out)
Get points.
static void plusEqOp(weightedPosition &x, const weightedPosition &y)
Summation operator.
weightedPosition()
Construct null.
static void syncPoints(const polyMesh &mesh, List< weightedPosition > &)
Synchronisation for mesh point positions.
static void setPoints(const UList< point > &in, UList< weightedPosition > &out)
Set points.
void operator()(const vectorTensorTransform &vt, const bool forward, UList< weightedPosition > &fld) const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
vector point
Point is a vector.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.