faMeshBoundaryHalo.H
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) 2021 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 Class
27  Foam::faMeshBoundaryHalo
28 
29 Description
30  Class for obtaining halo face data for the boundary edges.
31  The ordering follows that natural edge ordering of the underlying
32  primitive patch.
33 
34 Note
35  The halo faces can be located on-processor or off-processor.
36 
37 SourceFiles
38  faMeshBoundaryHalo.C
39  faMeshBoundaryHaloTemplates.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef faMeshBoundaryHalo_H
44 #define faMeshBoundaryHalo_H
45 
46 #include "mapDistributeBase.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward Declarations
54 class faMesh;
55 
56 /*---------------------------------------------------------------------------*\
57  Class faMeshBoundaryHalo Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 :
62  public mapDistributeBase
63 {
64  // Private Data
65 
66  //- List of local input mesh faces required
67  labelList inputMeshFaces_;
68 
69  //- Internal mapping from boundary index to compact
70  labelList boundaryToCompact_;
71 
72 
73 public:
74 
75  // Declare name of the class and its debug switch
76  ClassName("faMeshBoundaryHalo");
77 
78 
79  // Constructors
80 
81  //- Default construct
82  explicit faMeshBoundaryHalo(const label comm = UPstream::worldComm);
83 
84  //- Construct from mesh
85  explicit faMeshBoundaryHalo(const faMesh& mesh);
86 
87 
88  // Member Functions
89 
90  //- Clear out all parameters
91  void clear();
92 
93  //- Redefine map and connectivity for a mesh
94  void reset(const faMesh& mesh);
95 
96  //- The local data size (output)
97  label haloSize() const;
98 
99  //- List of local input mesh faces required.
100  // \note will not correspond exactly to the boundary inside faces.
101  // Duplicates have been removed and it also contains the
102  // processor-local neighbour faces, which would otherwise not be
103  // handled by the distribute method.
104  const labelList& inputMeshFaces() const noexcept
105  {
106  return inputMeshFaces_;
107  }
108 
109 
110  // Other
111 
112  //- Distribute sparse data.
113  // On output it is adjusted.
114  template<class Type>
115  void distributeSparse
116  (
117  List<Type>& fld,
118  const labelUList& sparseInputLocations,
119  const labelUList& compactOutputMapping
120  ) const;
121 
122  //- Distribute sparse data.
123  // On output it is adjusted.
124  template<class Type>
125  void distributeSparse
126  (
127  List<Type>& fld,
128  const labelUList& sparseInputLocations
129  ) const;
130 
131  //- Distribute sparse data.
132  // The input field one enty per sparse id (inputMeshFaces).
133  // On output it will have for the input sparse
134  // The input field contains location.
135  template<class Type>
136  void distributeSparse(List<Type>& fld) const;
137 };
138 
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 } // End namespace Foam
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 #ifdef NoRepository
148 #endif
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #endif
153 
154 // ************************************************************************* //
mapDistributeBase.H
Foam::faMeshBoundaryHalo::faMeshBoundaryHalo
faMeshBoundaryHalo(const label comm=UPstream::worldComm)
Default construct.
Definition: faMeshBoundaryHalo.C:43
Foam::faMeshBoundaryHalo::inputMeshFaces
const labelList & inputMeshFaces() const noexcept
List of local input mesh faces required.
Definition: faMeshBoundaryHalo.H:103
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
faMeshBoundaryHaloTemplates.C
Foam::mapDistributeBase::comm
label comm() const
Definition: mapDistributeBase.H:336
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::faMeshBoundaryHalo::clear
void clear()
Clear out all parameters.
Definition: faMeshBoundaryHalo.C:63
Foam::faMeshBoundaryHalo::reset
void reset(const faMesh &mesh)
Redefine map and connectivity for a mesh.
Definition: faMeshBoundaryHalo.C:85
Foam::faMeshBoundaryHalo::ClassName
ClassName("faMeshBoundaryHalo")
Foam::faMeshBoundaryHalo::haloSize
label haloSize() const
The local data size (output)
Definition: faMeshBoundaryHalo.C:72
Foam::UPstream::worldComm
static label worldComm
Default communicator (all processors)
Definition: UPstream.H:293
Foam::List< label >
Foam::faMeshBoundaryHalo::distributeSparse
void distributeSparse(List< Type > &fld, const labelUList &sparseInputLocations, const labelUList &compactOutputMapping) const
Distribute sparse data.
Definition: faMeshBoundaryHaloTemplates.C:36
Foam::UList< label >
Foam::mapDistributeBase
Class containing processor-to-processor mapping information.
Definition: mapDistributeBase.H:103
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
Foam::faMeshBoundaryHalo
Class for obtaining halo face data for the boundary edges. The ordering follows that natural edge ord...
Definition: faMeshBoundaryHalo.H:59