LagrangianBoundaryMesh.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "LagrangianBoundaryMesh.H"
27 #include "LagrangianPatch.H"
28 #include "LagrangianMesh.H"
29 #include "polyBoundaryMesh.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
34 (
35  const LagrangianMesh& mesh,
36  const polyBoundaryMesh& pbm
37 )
38 :
39  LagrangianBoundaryMesh(mesh, pbm, pbm.types())
40 {}
41 
42 
44 (
45  const LagrangianMesh& mesh,
46  const polyBoundaryMesh& pbm,
47  const wordList& wantedPatchTypes
48 )
49 :
50  PtrList<LagrangianPatch>(pbm.size()),
51  mesh_(mesh)
52 {
53  forAll(*this, patchi)
54  {
55  this->set
56  (
57  patchi,
59  (
60  wantedPatchTypes[patchi],
61  pbm[patchi],
62  *this
63  )
64  );
65  }
66 }
67 
68 
69 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
70 
72 {}
73 
74 
75 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
76 
78 (
79  const word& patchName
80 ) const
81 {
82  return mesh().mesh().boundaryMesh().findIndex(patchName);
83 }
84 
85 
87 (
88  const wordRe& key,
89  const bool useGroups
90 ) const
91 {
92  return mesh().mesh().boundaryMesh().findIndices(key, useGroups);
93 }
94 
95 
96 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:433
Boundary part of a Lagrangian mesh. Just a list of Lagrangian patches with some added convenience fun...
label findIndex(const word &patchName) const
Find patch index given a name.
labelList findIndices(const wordRe &, const bool useGroups) const
Find patch indices given a name.
LagrangianBoundaryMesh(const LagrangianMesh &, const polyBoundaryMesh &)
Construct from LagrangianMesh and polyBoundaryMesh.
Class containing Lagrangian geometry and topology.
Base class for Lagrangian patches.
static autoPtr< LagrangianPatch > New(const word &type, const polyPatch &patch, const LagrangianBoundaryMesh &boundaryMesh)
Return a pointer to a new LagrangianPatch of specified type.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
bool set(const label) const
Is element set.
Definition: PtrListI.H:62
const polyMesh & mesh() const
Return reference to polyMesh.
Definition: fvMesh.H:443
Foam::polyBoundaryMesh.
label findIndex(const word &patchName) const
Find patch index given a name.
labelList findIndices(const wordRe &, const bool usePatchGroups=true) const
Return patch indices for all matches. Optionally matches patchGroups.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:401
A wordRe is a word, but can also have a regular expression for matching words.
Definition: wordRe.H:77
A class for handling words, derived from string.
Definition: word.H:62
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
label patchi
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59