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-2017 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  tmp<labelField> tfld(new labelField(faceCells_.size()));
69  labelField& fld = tfld.ref();
70  forAll(faceCells_, i)
71  {
72  fld[i] = internalData[faceCells_[i]];
73  }
74  return tfld;
75 }
76 
77 
79 (
80  const Pstream::commsTypes commsType,
81  const labelUList& iF
82 ) const
83 {
84  processorLduInterface::send(commsType, interfaceInternalField(iF)());
85 }
86 
87 
90 (
91  const Pstream::commsTypes commsType,
92  const labelUList&
93 ) const
94 {
95  return processorLduInterface::receive<label>(commsType, faceCells_.size());
96 }
97 
98 
99 // ************************************************************************* //
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::lduPrimitiveProcessorInterface::interfaceInternalField
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to.
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:90
Foam::lduPrimitiveProcessorInterface::initInternalFieldTransfer
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Initialise neighbour field transfer.
Definition: lduPrimitiveProcessorInterface.C:79
transformField.H
Spatial transformation functions for primitive fields.
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:228
Foam::Field< tensor >
Foam::labelField
Field< label > labelField
Specialisation of Field<T> for label.
Definition: labelField.H:52
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::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