lduPrimitiveProcessorInterface.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) 2016-2019 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 "transformField.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeName(lduPrimitiveProcessorInterface);
36 }
37 
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
41 Foam::lduPrimitiveProcessorInterface::lduPrimitiveProcessorInterface
42 (
43  const labelUList& faceCells,
44  const label myProcNo,
45  const label neighbProcNo,
46  const tensorField& forwardT,
47  const int tag,
48  const label comm
49 )
50 :
51  faceCells_(faceCells),
52  myProcNo_(myProcNo),
53  neighbProcNo_(neighbProcNo),
54  forwardT_(forwardT),
55  tag_(tag),
56  comm_(comm)
57 {}
58 
59 
60 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
61 
64 (
65  const labelUList& internalData
66 ) const
67 {
68  return interfaceInternalField(internalData, faceCells_);
69 }
70 
71 
74 (
75  const labelUList& internalData,
76  const labelUList& faceCells
77 ) const
78 {
79  auto tfld = tmp<labelField>::New(faceCells.size());
80  auto& fld = tfld.ref();
81 
82  forAll(faceCells, i)
83  {
84  fld[i] = internalData[faceCells[i]];
85  }
86  return tfld;
87 }
88 
89 
91 (
92  const Pstream::commsTypes commsType,
93  const labelUList& iF
94 ) const
95 {
96  processorLduInterface::send(commsType, interfaceInternalField(iF)());
97 }
98 
99 
101 (
102  const Pstream::commsTypes commsType,
103  const labelUList& iF,
104  const labelUList& faceCells
105 ) const
106 {
107  processorLduInterface::send
108  (
109  commsType,
110  interfaceInternalField(iF, faceCells)()
111  );
112 }
113 
114 
117 (
118  const Pstream::commsTypes commsType,
119  const labelUList&
120 ) const
121 {
122  return processorLduInterface::receive<label>(commsType, faceCells_.size());
123 }
124 
125 // ************************************************************************* //
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::lduPrimitiveProcessorInterface::interfaceInternalField
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Definition: lduPrimitiveProcessorInterface.C:64
Foam::lduPrimitiveProcessorInterface::internalFieldTransfer
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
Definition: lduPrimitiveProcessorInterface.C:117
Foam::lduPrimitiveProcessorInterface::initInternalFieldTransfer
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Initialise neighbour field transfer.
Definition: lduPrimitiveProcessorInterface.C:91
transformField.H
Spatial transformation functions for primitive fields.
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::Field< tensor >
Foam::defineTypeName
defineTypeName(ensightPart)
fld
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;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::UList< label >
lduPrimitiveProcessorInterface.H
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56