mappedPatchBaseI.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) 2011-2015 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
27 
30 {
31  return mode_;
32 }
33 
34 
36 {
37  if (sampleRegion_.empty())
38  {
39  if (!coupleGroup_.valid())
40  {
42  << "Supply either a regionName or a coupleGroup"
43  << " for patch " << patch_.name()
44  << " in region " << patch_.boundaryMesh().mesh().name()
45  << exit(FatalError);
46  }
47 
48  // Try and use patchGroup to find samplePatch and sampleRegion
49  label samplePatchID = coupleGroup_.findOtherPatchID
50  (
51  patch_,
52  sampleRegion_
53  );
54 
55  samplePatch_ = sampleMesh().boundaryMesh()[samplePatchID].name();
56  }
57  return sampleRegion_;
58 }
59 
60 
62 {
63  if (samplePatch_.empty())
64  {
65  if (!coupleGroup_.valid())
66  {
68  << "Supply either a patchName or a coupleGroup"
69  << " for patch " << patch_.name()
70  << " in region " << patch_.boundaryMesh().mesh().name()
71  << exit(FatalError);
72  }
73 
74  // Try and use patchGroup to find samplePatch and sampleRegion
75  label samplePatchID = coupleGroup_.findOtherPatchID
76  (
77  patch_,
78  sampleRegion_
79  );
80 
81  samplePatch_ = sampleMesh().boundaryMesh()[samplePatchID].name();
82  }
83  return samplePatch_;
84 }
85 
86 
88 {
89  return coupleGroup_.name();
90 }
91 
92 
94 {
95  switch (mode_)
96  {
97  case NEARESTPATCHFACEAMI:
98  {
99  return samplePolyPatch().size();
100  }
101  case NEARESTCELL:
102  {
103  return sampleMesh().nCells();
104  }
105  case NEARESTPATCHFACE:
106  {
107  return samplePolyPatch().size();
108  }
109  case NEARESTPATCHPOINT:
110  {
111  return samplePolyPatch().nPoints();
112  }
113  case NEARESTFACE:
114  {
115  const polyMesh& mesh = sampleMesh();
116  return mesh.nBoundaryFaces();
117  }
118  default:
119  {
121  << "problem." << abort(FatalError);
122  return -1;
123  }
124  }
125 }
126 
127 
129 {
130  return offset_;
131 }
132 
133 
135 {
136  return offsets_;
137 }
138 
139 
141 {
142  return sameRegion_;
143 }
144 
145 
147 {
148  if (mapPtr_.empty())
149  {
150  calcMapping();
151  }
152 
153  return *mapPtr_;
154 }
155 
156 
158 (
159  bool forceUpdate
160 ) const
161 {
162  if (forceUpdate || AMIPtr_.empty())
163  {
164  calcAMI();
165  }
166 
167  return *AMIPtr_;
168 }
169 
170 
171 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::mappedPatchBase::map
const mapDistribute & map() const
Return reference to the parallel distribution map.
Definition: mappedPatchBaseI.H:146
Foam::mappedPatchBase::mode_
const sampleMode mode_
What to sample.
Definition: mappedPatchBase.H:197
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::mappedPatchBase::offset
const vector & offset() const
Offset vector (from patch faces to destination mesh objects)
Definition: mappedPatchBaseI.H:128
Foam::mappedPatchBase::sampleSize
label sampleSize() const
Return size of mapped mesh/patch/boundary.
Definition: mappedPatchBaseI.H:93
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:62
Foam::Field< vector >
Foam::mapDistribute
Class containing processor-to-processor mapping information.
Definition: mapDistribute.H:163
Foam::mappedPatchBase::mode
const sampleMode & mode() const
What to sample.
Definition: mappedPatchBaseI.H:29
Foam::FatalError
error FatalError
Foam::primitiveMesh::nBoundaryFaces
label nBoundaryFaces() const
Number of boundary faces (== nFaces - nInternalFaces)
Definition: primitiveMeshI.H:84
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:137
Foam::mappedPatchBase::coupleGroup
const word & coupleGroup() const
PatchGroup (only if NEARESTPATCHFACE)
Definition: mappedPatchBaseI.H:87
Foam::mappedPatchBase::sampleRegion
const word & sampleRegion() const
Region to sample.
Definition: mappedPatchBaseI.H:35
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
Foam::Vector< scalar >
Foam::AMIInterpolation
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
Definition: AMIInterpolation.H:81
Foam::mappedPatchBase::AMI
const AMIPatchToPatchInterpolation & AMI(const bool forceUpdate=false) const
Return reference to the AMI interpolator.
Definition: mappedPatchBaseI.H:158
Foam::mappedPatchBase::sameRegion
bool sameRegion() const
Cached sampleRegion != mesh.name()
Definition: mappedPatchBaseI.H:140
Foam::mappedPatchBase::sampleMode
sampleMode
Mesh items to sample.
Definition: mappedPatchBase.H:113
Foam::mappedPatchBase::offsets
const vectorField & offsets() const
Offset vector (from patch faces to destination mesh objects)
Definition: mappedPatchBaseI.H:134
Foam::mappedPatchBase::samplePatch
const word & samplePatch() const
Patch (only if NEARESTPATCHFACE)
Definition: mappedPatchBaseI.H:61