star.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) 2021-2023 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 "star.H"
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 void Foam::star::reset()
31 {
32  forAll(starFaceFaces_, starFacei)
33  {
34  const label facei = starFaceFaces_[starFacei];
35  if (facei != -1)
36  {
37  faceStarFaces_[starFaceFaces_[starFacei]] = -1;
38  }
39  }
40  starFaceFaces_.clear();
41 
42  forAll(starEdgeEdges_, starEdgei)
43  {
44  const label edgei = starEdgeEdges_[starEdgei].edgei_;
45  if (edgei != -1)
46  {
47  edgeStarEdges_[edgei] = -1;
48  }
49  }
50  starEdgeEdges_.clear();
51 }
52 
53 
54 void Foam::star::swapStarEdges(const label starEdgeiA, const label starEdgeiB)
55 {
56  const label starEdgeiA0 = starEdgeEdges_[starEdgeiA].starEdgei0_;
57  const label starEdgeiA1 = starEdgeEdges_[starEdgeiA].starEdgei1_;
58 
59  const label starEdgeiB0 = starEdgeEdges_[starEdgeiB].starEdgei0_;
60  const label starEdgeiB1 = starEdgeEdges_[starEdgeiB].starEdgei1_;
61 
62  if (starEdgeiA0 != -1)
63  {
64  starEdgeEdges_[starEdgeiA0].starEdgei1_ = starEdgeiB;
65  }
66  if (starEdgeiA1 != -1)
67  {
68  starEdgeEdges_[starEdgeiA1].starEdgei0_ = starEdgeiB;
69  }
70 
71  if (starEdgeiB0 != -1)
72  {
73  starEdgeEdges_[starEdgeiB0].starEdgei1_ = starEdgeiA;
74  }
75  if (starEdgeiB1 != -1)
76  {
77  starEdgeEdges_[starEdgeiB1].starEdgei0_ = starEdgeiA;
78  }
79 
80  Swap(starEdgeEdges_[starEdgeiA], starEdgeEdges_[starEdgeiB]);
81 }
82 
83 
84 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
85 
87 :
88  starFaceFaces_(),
89  faceStarFaces_(),
90  starEdgeEdges_(),
91  edgeStarEdges_(),
92  work_()
93 {}
94 
95 
97 :
98  star_(s)
99 {}
100 
101 
102 // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
103 
105 {}
106 
107 
109 {
110  star_.reset();
111 }
112 
113 
114 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
void clear()
Clear the addressed list, i.e. set the size to zero.
Definition: DynamicListI.H:236
context(star &s)
Construct from components.
Definition: star.C:96
Engine for constructing a star-shaped domain by walking.
Definition: star.H:50
star()
Construct null.
Definition: star.C:86
~star()
Definition: star.C:104
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
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
void Swap(T &a, T &b)
Definition: Swap.H:43