weightedPositionTemplates.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2020 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
29#include "coupledPolyPatch.H"
30
31// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
32
33template<template<class> class Container>
35(
36 const coupledPolyPatch& cpp,
37 Container<weightedPosition>& map
38)
39const
40{
41 Field<point> fld(map.size());
42 label i = 0;
43 forAllConstIters(map, iter)
44 {
45 point pt(iter->second());
46 if (mag(iter->first()) > VSMALL)
47 {
48 pt /= iter->first();
49 }
50 fld[i++] = pt;
51 }
52 cpp.transformPosition(fld);
53 i = 0;
54 forAllIters(map, iter)
55 {
56 iter->second() = fld[i++]*iter->first();
57 }
58}
59
60
61// ************************************************************************* //
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Generic templated field type.
Definition: Field.H:82
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
#define forAllIters(container, iter)
Iterate across all elements in the container object.
Definition: stdFoam.H:260
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
Definition: stdFoam.H:278