cloudSet.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 "cloudSet.H"
00028 #include "sampledSet.H"
00029 #include "meshSearch.H"
00030 #include "DynamicList.H"
00031 #include "polyMesh.H"
00032 #include "addToRunTimeSelectionTable.H"
00033 #include "word.H"
00034
00035
00036
00037 namespace Foam
00038 {
00039 defineTypeNameAndDebug(cloudSet, 0);
00040 addToRunTimeSelectionTable(sampledSet, cloudSet, word);
00041 }
00042
00043
00044
00045
00046 void Foam::cloudSet::calcSamples
00047 (
00048 DynamicList<point>& samplingPts,
00049 DynamicList<label>& samplingCells,
00050 DynamicList<label>& samplingFaces,
00051 DynamicList<label>& samplingSegments,
00052 DynamicList<scalar>& samplingCurveDist
00053 ) const
00054 {
00055 forAll(sampleCoords_, sampleI)
00056 {
00057 label cellI = searchEngine().findCell(sampleCoords_[sampleI]);
00058
00059 if (cellI != -1)
00060 {
00061 samplingPts.append(sampleCoords_[sampleI]);
00062 samplingCells.append(cellI);
00063 samplingFaces.append(-1);
00064 samplingSegments.append(0);
00065 samplingCurveDist.append(1.0 * sampleI);
00066 }
00067 }
00068 }
00069
00070
00071 void Foam::cloudSet::genSamples()
00072 {
00073
00074 DynamicList<point> samplingPts;
00075 DynamicList<label> samplingCells;
00076 DynamicList<label> samplingFaces;
00077 DynamicList<label> samplingSegments;
00078 DynamicList<scalar> samplingCurveDist;
00079
00080 calcSamples
00081 (
00082 samplingPts,
00083 samplingCells,
00084 samplingFaces,
00085 samplingSegments,
00086 samplingCurveDist
00087 );
00088
00089 samplingPts.shrink();
00090 samplingCells.shrink();
00091 samplingFaces.shrink();
00092 samplingSegments.shrink();
00093 samplingCurveDist.shrink();
00094
00095 setSamples
00096 (
00097 samplingPts,
00098 samplingCells,
00099 samplingFaces,
00100 samplingSegments,
00101 samplingCurveDist
00102 );
00103 }
00104
00105
00106
00107
00108 Foam::cloudSet::cloudSet
00109 (
00110 const word& name,
00111 const polyMesh& mesh,
00112 meshSearch& searchEngine,
00113 const word& axis,
00114 const List<point>& sampleCoords
00115 )
00116 :
00117 sampledSet(name, mesh, searchEngine, axis),
00118 sampleCoords_(sampleCoords)
00119 {
00120 genSamples();
00121
00122 if (debug)
00123 {
00124 write(Info);
00125 }
00126 }
00127
00128
00129 Foam::cloudSet::cloudSet
00130 (
00131 const word& name,
00132 const polyMesh& mesh,
00133 meshSearch& searchEngine,
00134 const dictionary& dict
00135 )
00136 :
00137 sampledSet(name, mesh, searchEngine, dict),
00138 sampleCoords_(dict.lookup("points"))
00139 {
00140 genSamples();
00141
00142 if (debug)
00143 {
00144 write(Info);
00145 }
00146 }
00147
00148
00149
00150
00151 Foam::cloudSet::~cloudSet()
00152 {}
00153
00154
00155
00156
00157 Foam::point Foam::cloudSet::getRefPoint(const List<point>& pts) const
00158 {
00159 if (pts.size())
00160 {
00161
00162 return pts[0];
00163 }
00164 else
00165 {
00166 return vector::zero;
00167 }
00168 }
00169
00170
00171
Copyright © 2000-2009 OpenCFD Ltd