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-2022 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 {
36 }
37 
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42 (
44 )
45 :
46  faceCells_(p.faceCells()),
47  myProcNo_(p.myProcNo()),
48  neighbProcNo_(p.neighbProcNo()),
49  forwardT_(p.forwardT()),
50  tag_(p.tag()),
51  comm_(p.comm())
52 {}
53 
54 
56 (
57  const labelUList& faceCells,
58  const label myProcNo,
59  const label neighbProcNo,
60  const tensorField& forwardT,
61  const int tag,
62  const label comm
63 )
64 :
65  faceCells_(faceCells),
66  myProcNo_(myProcNo),
67  neighbProcNo_(neighbProcNo),
68  forwardT_(forwardT),
69  tag_(tag),
70  comm_(comm)
71 {}
72 
73 
74 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
75 
78 (
79  const labelUList& internalData
80 ) const
81 {
82  return interfaceInternalField(internalData, faceCells_);
83 }
84 
85 
88 (
89  const labelUList& internalData,
90  const labelUList& faceCells
91 ) const
92 {
93  auto tfld = tmp<labelField>::New(faceCells.size());
94  auto& fld = tfld.ref();
95 
96  forAll(faceCells, i)
97  {
98  fld[i] = internalData[faceCells[i]];
99  }
100  return tfld;
101 }
102 
103 
105 (
106  const Pstream::commsTypes commsType,
107  const labelUList& iF
108 ) const
109 {
110  processorLduInterface::send(commsType, interfaceInternalField(iF)());
111 }
112 
113 
115 (
116  const Pstream::commsTypes commsType,
117  const labelUList& iF,
118  const labelUList& faceCells
119 ) const
120 {
122  (
123  commsType,
124  interfaceInternalField(iF, faceCells)()
125  );
126 }
127 
128 
131 (
132  const Pstream::commsTypes commsType,
133  const labelUList&
134 ) const
135 {
136  return processorLduInterface::receive<label>(commsType, faceCells_.size());
137 }
138 
139 
140 // ************************************************************************* //
void send(const UPstream::commsTypes commsType, const UList< Type > &f) const
Raw send function.
commsTypes
Communications types.
Definition: UPstream.H:72
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:52
UList< label > labelUList
A UList of labels.
Definition: UList.H:78
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
defineTypeName(manifoldCellsMeshObject)
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to the interface as a field.
Spatial transformation functions for primitive fields.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition: tmp.H:206
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Initialise neighbour field transfer.
Concrete implementation of processor interface. Used to temporarily store settings.
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))
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50
lduPrimitiveProcessorInterface(const labelUList &faceCells, const label myProcNo, const label neighbProcNo, const tensorField &forwardT, const int tag, const label comm=UPstream::worldComm)
Construct from components.
Namespace for OpenFOAM.