OpenFOAM logo
Open Source CFD Toolkit

samplingLine.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     samplingLine
00027 
00028 Description
00029     This class samples the given volScalarField along a line specified
00030     with its start, end and the number of points
00031 
00032 SourceFiles
00033     samplingLine.C
00034     pointAdressing.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef samplingLine_H
00039 #define samplingLine_H
00040 
00041 #include "point.H"
00042 #include "pointAddressing.H"
00043 #include "primitiveFields.H"
00044 #include "SLList.H"
00045 #include "volFieldsFwd.H"
00046 #include "volMesh.H"
00047 
00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00049 
00050 namespace Foam
00051 {
00052 
00053 /*---------------------------------------------------------------------------*\
00054                            Class samplingLine Declaration
00055 \*---------------------------------------------------------------------------*/
00056 
00057 class samplingLine
00058 {
00059     // Private data
00060 
00061         const fvMesh& mesh_;
00062 
00063         point start_, end_;
00064         label nPoints_;
00065 
00066         vectorField points_;
00067         scalarField parametricX_;
00068         SLList<pointAddressing> addressingData_;
00069 
00070 
00071     // Private Member Functions
00072 
00073         //- Calculate addressing
00074         void calcAddressing();
00075 
00076         //- Checks if the point is inside the cell
00077         bool checkPoint(const point&, label, const vectorField&) const;
00078 
00079 
00080     // Dissallow default bitwise operator= and copy construct
00081 
00082         samplingLine(const samplingLine&);
00083         samplingLine& operator=(const samplingLine&);
00084 
00085 
00086 public:
00087 
00088     // Constructors
00089 
00090         //- Construct from components
00091         samplingLine
00092         (
00093             const fvMesh& mesh,
00094             const point& start,
00095             const point& end,
00096             const label noPoints = 50
00097         );
00098 
00099 
00100         //- Construct from mesh and Istream
00101         samplingLine
00102         (
00103             const fvMesh& mesh,
00104             Istream&
00105         );
00106 
00107 
00108     // Member Functions
00109 
00110         // Access
00111 
00112             const vectorField& points() const
00113             {
00114                 return points_;
00115             }
00116 
00117             const scalarField& parametricX() const
00118             {
00119                 return parametricX_;
00120             }
00121 
00122 
00123         // Interpolate
00124 
00125             //- Uses the nearest cell value as the interpolate
00126             scalarField simpleInterpolate(const volScalarField& f) const;
00127 
00128             //- Calculates the cell gradient of f and calls next function
00129             scalarField interpolate(const volScalarField& f) const;
00130 
00131             //- Uses the cell gradient to perform a second order interpolate
00132             scalarField interpolate
00133             (
00134                 const volScalarField& f,
00135                 const volVectorField& gradf
00136             ) const;
00137 };
00138 
00139 
00140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00141 
00142 } // End namespace Foam
00143 
00144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00145 
00146 #endif
00147 
00148 // ************************************************************************* //
For further information go to www.openfoam.org