Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
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 "transformField.H"
30
31// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32
33namespace Foam
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,
91) const
92{
93 auto tfld = tmp<labelField>::New(faceCells.size());
94 auto& fld = tfld.ref();
95
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{
111}
112
113
115(
116 const Pstream::commsTypes commsType,
117 const labelUList& iF,
118 const labelUList& faceCells
119) const
120{
122 (
131(
132 const Pstream::commsTypes commsType,
133 const labelUList&
134) const
135{
136 return processorLduInterface::receive<label>(commsType, faceCells_.size());
137}
138
139
140// ************************************************************************* //
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))
commsTypes
Communications types.
Definition UPstream.H:81
Smooth ATC in cells next to a set of patches supplied by type.
Definition faceCells.H:55
Concrete implementation of processor interface. Used to temporarily store settings.
virtual const labelUList & faceCells() const
Return faceCell addressing.
virtual int myProcNo() const
Return processor number (rank in communicator).
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Initialise neighbour field transfer.
virtual label comm() const
Return communicator used for sending.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to the interface as a field.
lduPrimitiveProcessorInterface(const labelUList &faceCells, const label myProcNo, const label neighbProcNo, const tensorField &forwardT, const int tag, const label comm=UPstream::worldComm)
Construct from components.
virtual int tag() const
Return message tag used for sending.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
virtual int neighbProcNo() const
Return neighbour processor number (rank in communicator).
virtual const tensorField & forwardT() const
Return face transformation tensor.
void receive(const UPstream::commsTypes commsType, UList< Type > &f) const
Raw receive function.
void send(const UPstream::commsTypes commsType, const UList< Type > &f) const
Raw send function.
A class for managing temporary objects.
Definition tmp.H:75
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition tmp.H:215
#define defineTypeName(Type)
Define the typeName.
Definition className.H:113
volScalarField & p
Namespace for OpenFOAM.
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
UList< label > labelUList
A UList of labels.
Definition UList.H:75
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299
Spatial transformation functions for primitive fields.