pointPatchDist.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 | Copyright (C) 2013 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 "pointPatchDist.H"
27 #include "externalPointEdgePoint.H"
28 #include "pointMesh.H"
29 #include "PointEdgeWave.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
34 (
35  const pointMesh& pMesh,
36  const labelHashSet& patchIDs,
37  const pointField& points
38 )
39 :
41  (
42  IOobject
43  (
44  "pointDistance",
45  pMesh.db().time().timeName(),
46  pMesh.db()
47  ),
48  pMesh,
49  dimensionedScalar("y", dimLength, GREAT)
50  ),
51  points_(points),
52  patchIDs_(patchIDs),
53  nUnset_(0)
54 {
55  correct();
56 }
57 
58 
59 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
60 
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 
68 {
69  const pointBoundaryMesh& pbm = mesh().boundary();
70 
71  label nPoints = 0;
72 
73  forAllConstIter(labelHashSet, patchIDs_, iter)
74  {
75  label patchI = iter.key();
76  nPoints += pbm[patchI].meshPoints().size();
77  }
78 
80 
81  // Set initial changed points to all the patch points(if patch present)
83  labelList wallPoints(nPoints);
84  nPoints = 0;
85 
86  forAllConstIter(labelHashSet, patchIDs_, iter)
87  {
88  label patchI = iter.key();
89  // Retrieve the patch now we have its index in patches.
90 
91  const labelList& mp = pbm[patchI].meshPoints();
92 
93  forAll(mp, ppI)
94  {
95  label meshPointI = mp[ppI];
96  wallPoints[nPoints] = meshPointI;
98  (
99  td.points_[meshPointI],
100  0.0
101  );
102  nPoints++;
103  }
104  }
105 
106  // Current info on points
107  List<externalPointEdgePoint> allPointInfo(mesh()().nPoints());
108 
109  // Current info on edges
110  List<externalPointEdgePoint> allEdgeInfo(mesh()().nEdges());
111 
113  <
116  > wallCalc
117  (
118  mesh()(),
119  wallPoints,
120  wallInfo,
121 
122  allPointInfo,
123  allEdgeInfo,
124  mesh().globalData().nTotalPoints(), // max iterations
125  td
126  );
127 
128  pointScalarField& psf = *this;
129 
130 
131  forAll(allPointInfo, pointI)
132  {
133  if (allPointInfo[pointI].valid(td))
134  {
135  psf[pointI] = Foam::sqrt(allPointInfo[pointI].distSqr());
136  }
137  else
138  {
139  nUnset_++;
140  }
141  }
142 }
143 
144 
145 // ************************************************************************* //
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::constant::atomic::mp
const dimensionedScalar mp
Proton mass.
Foam::pointPatchDist::correct
void correct()
Correct for mesh geom/topo changes.
Definition: pointPatchDist.C:67
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::externalPointEdgePoint
Holds information regarding nearest wall point. Used in PointEdgeWave. (so not standard FaceCellWave)...
Definition: externalPointEdgePoint.H:55
Foam::PointEdgeWave
Wave propagation of information through grid. Every iteration information goes through one layer of e...
Definition: PointEdgeWave.H:85
Foam::objectRegistry::time
const Time & time() const
Return time.
Definition: objectRegistry.H:117
Foam::HashSet< label, Hash< label > >
forAllConstIter
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
Foam::IOobject::db
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:239
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
Foam::externalPointEdgePoint::trackingData
Class used to pass data into container.
Definition: externalPointEdgePoint.H:94
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
PointEdgeWave.H
externalPointEdgePoint.H
correct
fvOptions correct(rho)
Foam::externalPointEdgePoint::trackingData::points_
const pointField & points_
Definition: externalPointEdgePoint.H:97
Foam::pointPatchDist::pointPatchDist
pointPatchDist(const pointPatchDist &)
Disallow default bitwise copy construct.
Foam::pointPatchDist::~pointPatchDist
virtual ~pointPatchDist()
Destructor.
Definition: pointPatchDist.C:61
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam::pointMesh
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:48
pointPatchDist.H
Foam::pointScalarField
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
Definition: pointFields.H:49
Foam::pointBoundaryMesh
Foam::pointBoundaryMesh.
Definition: pointBoundaryMesh.H:52
Foam::fvMesh::boundary
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:550
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:142
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::PtrList::size
label size() const
Return the number of elements in the PtrList.
Definition: PtrListI.H:32
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
pointMesh.H