sampledPatch.C
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 #include "sampledPatch.H"
00028 #include "dictionary.H"
00029 #include "polyMesh.H"
00030 #include "polyPatch.H"
00031 #include "volFields.H"
00032
00033 #include "addToRunTimeSelectionTable.H"
00034
00035
00036
00037 namespace Foam
00038 {
00039 defineTypeNameAndDebug(sampledPatch, 0);
00040 addNamedToRunTimeSelectionTable(sampledSurface, sampledPatch, word, patch);
00041 }
00042
00043
00044
00045
00046 Foam::sampledPatch::sampledPatch
00047 (
00048 const word& name,
00049 const polyMesh& mesh,
00050 const word& patchName,
00051 const bool triangulate
00052 )
00053 :
00054 sampledSurface(name, mesh),
00055 patchName_(patchName),
00056 triangulate_(triangulate),
00057 needsUpdate_(true),
00058 patchFaceLabels_(0)
00059 {}
00060
00061
00062 Foam::sampledPatch::sampledPatch
00063 (
00064 const word& name,
00065 const polyMesh& mesh,
00066 const dictionary& dict
00067 )
00068 :
00069 sampledSurface(name, mesh, dict),
00070 patchName_(dict.lookup("patchName")),
00071 triangulate_(dict.lookupOrDefault("triangulate", false)),
00072 needsUpdate_(true),
00073 patchFaceLabels_(0)
00074 {}
00075
00076
00077
00078
00079 Foam::sampledPatch::~sampledPatch()
00080 {}
00081
00082
00083
00084
00085 bool Foam::sampledPatch::needsUpdate() const
00086 {
00087 return needsUpdate_;
00088 }
00089
00090
00091 bool Foam::sampledPatch::expire()
00092 {
00093
00094 if (needsUpdate_)
00095 {
00096 return false;
00097 }
00098
00099 sampledSurface::clearGeom();
00100 MeshStorage::clear();
00101 patchFaceLabels_.clear();
00102
00103 needsUpdate_ = true;
00104 return true;
00105 }
00106
00107
00108 bool Foam::sampledPatch::update()
00109 {
00110 if (!needsUpdate_)
00111 {
00112 return false;
00113 }
00114
00115 label patchI = mesh().boundaryMesh().findPatchID(patchName_);
00116
00117 if (patchI != -1)
00118 {
00119 const polyPatch& p = mesh().boundaryMesh()[patchI];
00120 this->storedPoints() = p.localPoints();
00121 this->storedFaces() = p.localFaces();
00122
00123
00124 patchFaceLabels_.setSize(faces().size());
00125 forAll(patchFaceLabels_, i)
00126 {
00127 patchFaceLabels_[i] = i;
00128 }
00129
00130
00131
00132
00133
00134 if (triangulate_)
00135 {
00136 MeshStorage::triangulate();
00137 }
00138 }
00139
00140 if (debug)
00141 {
00142 print(Pout);
00143 Pout << endl;
00144 }
00145
00146 needsUpdate_ = false;
00147 return true;
00148 }
00149
00150
00151
00152 void Foam::sampledPatch::remapFaces
00153 (
00154 const UList<label>& faceMap
00155 )
00156 {
00157
00158 if (&faceMap && faceMap.size())
00159 {
00160 MeshStorage::remapFaces(faceMap);
00161 }
00162 }
00163
00164
00165
00166 Foam::tmp<Foam::scalarField>
00167 Foam::sampledPatch::sample
00168 (
00169 const volScalarField& vField
00170 ) const
00171 {
00172 return sampleField(vField);
00173 }
00174
00175
00176 Foam::tmp<Foam::vectorField>
00177 Foam::sampledPatch::sample
00178 (
00179 const volVectorField& vField
00180 ) const
00181 {
00182 return sampleField(vField);
00183 }
00184
00185 Foam::tmp<Foam::sphericalTensorField>
00186 Foam::sampledPatch::sample
00187 (
00188 const volSphericalTensorField& vField
00189 ) const
00190 {
00191 return sampleField(vField);
00192 }
00193
00194
00195 Foam::tmp<Foam::symmTensorField>
00196 Foam::sampledPatch::sample
00197 (
00198 const volSymmTensorField& vField
00199 ) const
00200 {
00201 return sampleField(vField);
00202 }
00203
00204
00205 Foam::tmp<Foam::tensorField>
00206 Foam::sampledPatch::sample
00207 (
00208 const volTensorField& vField
00209 ) const
00210 {
00211 return sampleField(vField);
00212 }
00213
00214
00215 Foam::tmp<Foam::scalarField>
00216 Foam::sampledPatch::interpolate
00217 (
00218 const interpolation<scalar>& interpolator
00219 ) const
00220 {
00221 return interpolateField(interpolator);
00222 }
00223
00224
00225 Foam::tmp<Foam::vectorField>
00226 Foam::sampledPatch::interpolate
00227 (
00228 const interpolation<vector>& interpolator
00229 ) const
00230 {
00231 return interpolateField(interpolator);
00232 }
00233
00234 Foam::tmp<Foam::sphericalTensorField>
00235 Foam::sampledPatch::interpolate
00236 (
00237 const interpolation<sphericalTensor>& interpolator
00238 ) const
00239 {
00240 return interpolateField(interpolator);
00241 }
00242
00243
00244 Foam::tmp<Foam::symmTensorField>
00245 Foam::sampledPatch::interpolate
00246 (
00247 const interpolation<symmTensor>& interpolator
00248 ) const
00249 {
00250 return interpolateField(interpolator);
00251 }
00252
00253
00254 Foam::tmp<Foam::tensorField>
00255 Foam::sampledPatch::interpolate
00256 (
00257 const interpolation<tensor>& interpolator
00258 ) const
00259 {
00260 return interpolateField(interpolator);
00261 }
00262
00263
00264 void Foam::sampledPatch::print(Ostream& os) const
00265 {
00266 os << "sampledPatch: " << name() << " :"
00267 << " patch:" << patchName()
00268 << " faces:" << faces().size()
00269 << " points:" << points().size();
00270 }
00271
00272
00273
Copyright © 2000-2009 OpenCFD Ltd