directMappedPatchBase.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef directMappedPatchBase_H
00042 #define directMappedPatchBase_H
00043
00044 #include "pointField.H"
00045 #include "Tuple2.H"
00046 #include "pointIndexHit.H"
00047 #include "mapDistribute.H"
00048
00049
00050
00051
00052 namespace Foam
00053 {
00054
00055 class polyPatch;
00056 class polyMesh;
00057
00058
00059
00060
00061
00062 class directMappedPatchBase
00063 {
00064
00065 public:
00066
00067
00068 enum sampleMode
00069 {
00070 NEARESTCELL,
00071 NEARESTPATCHFACE,
00072 NEARESTFACE
00073 };
00074
00075 private:
00076
00077
00078
00079 static const NamedEnum<sampleMode, 3> sampleModeNames_;
00080
00081
00082 const polyPatch& patch_;
00083
00084
00085 const word sampleRegion_;
00086
00087
00088 const sampleMode mode_;
00089
00090
00091 const word samplePatch_;
00092
00093
00094 const vector offset_;
00095
00096
00097 const bool sameRegion_;
00098
00099
00100
00101
00102
00103
00104
00105
00106 mutable autoPtr<mapDistribute> mapPtr_;
00107
00108
00109
00110
00111
00112 void collectSamples
00113 (
00114 pointField&,
00115 labelList& patchFaceProcs,
00116 labelList& patchFaces,
00117 pointField& patchFc
00118 ) const;
00119
00120
00121 void findSamples
00122 (
00123 const pointField&,
00124 labelList& sampleProcs,
00125 labelList& sampleIndices,
00126 pointField& sampleLocations
00127 ) const;
00128
00129
00130 void calcMapping() const;
00131
00132
00133
00134
00135
00136
00137
00138
00139 typedef Tuple2<pointIndexHit, Tuple2<scalar, label> > nearInfo;
00140
00141 class nearestEqOp
00142 {
00143
00144 public:
00145
00146 void operator()(nearInfo& x, const nearInfo& y) const
00147 {
00148 if (y.first().hit())
00149 {
00150 if (!x.first().hit())
00151 {
00152 x = y;
00153 }
00154 else if (y.second().first() < x.second().first())
00155 {
00156 x = y;
00157 }
00158 }
00159 }
00160 };
00161
00162
00163 public:
00164
00165
00166 TypeName("directMappedPatchBase");
00167
00168
00169
00170
00171
00172 directMappedPatchBase(const polyPatch&);
00173
00174
00175 directMappedPatchBase(const polyPatch&, const dictionary&);
00176
00177
00178 directMappedPatchBase(const polyPatch&, const directMappedPatchBase&);
00179
00180
00181
00182 virtual ~directMappedPatchBase();
00183
00184
00185
00186
00187 void clearOut();
00188
00189
00190 const sampleMode& mode() const
00191 {
00192 return mode_;
00193 }
00194
00195
00196 const word& sampleRegion() const
00197 {
00198 return sampleRegion_;
00199 }
00200
00201
00202 const word& samplePatch() const
00203 {
00204 return samplePatch_;
00205 }
00206
00207
00208 const vector& offset() const
00209 {
00210 return offset_;
00211 }
00212
00213
00214 const mapDistribute& map() const
00215 {
00216 if (mapPtr_.empty())
00217 {
00218 calcMapping();
00219 }
00220 return mapPtr_();
00221 }
00222
00223
00224 bool sameRegion() const
00225 {
00226 return sameRegion_;
00227 }
00228
00229
00230 const polyMesh& sampleMesh() const;
00231
00232
00233 const polyPatch& samplePolyPatch() const;
00234
00235
00236 virtual void write(Ostream&) const;
00237 };
00238
00239
00240
00241
00242 }
00243
00244
00245
00246 #endif
00247
00248
Copyright © 2000-2009 OpenCFD Ltd