initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / postProcessing / sampling / sample / sample.C
blob12864fdceb7daf69c129b1e4b9eba68d04f46005
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Description
26     Sample field data with a choice of interpolation schemes, sampling options
27     and write formats.
29     Keywords:
31     @param setFormat : set output format, choice of \n
32       - xmgr
33       - jplot
34       - gnuplot
35       - raw
37     @param surfaceFormat : surface output format, choice of \n
38       - null        : suppress output
39       - foamFile    : separate points, faces and values file
40       - dx          : DX scalar or vector format
41       - vtk         : VTK ascii format
42       - raw         : x y z value format for use with e.g. gnuplot 'splot'.
43       - obj         : Wavefron stl. Does not contain values!
44       - stl         : ascii stl. Does not contain values!
46     @param interpolationScheme : interpolation scheme, choice of \n
47       - cell          : use cell-centre value; constant over cells (default)
48       - cellPoint     : use cell-centre and vertex values
49       - cellPointFace : use cell-centre, vertex and face values. \n
50         -# vertex values determined from neighbouring cell-centre values
51         -# face values determined using the current face interpolation scheme
52            for the field (linear, limitedLinear, etc.)
54     @param fields : list of fields to sample
56     @param sets : list of sets to sample, choice of \n
57       - uniform             evenly distributed points on line
58       - face                one point per face intersection
59       - midPoint            one point per cell, inbetween two face intersections
60       - midPointAndFace     combination of face and midPoint
62       - curve               specified points, not nessecary on line, uses
63                             tracking
64       - cloud               specified points, uses findCell
66         Option axis: how to write point coordinate. Choice of
67           - x/y/z: x/y/z coordinate only
68           - xyz: three columns
69             (probably does not make sense for anything but raw)
70           - distance: distance from start of sampling line (if uses line)
71             or distance from first specified sampling point
73         Type specific options:
74             uniform, face, midPoint, midPointAndFace : start and end coordinate
75             uniform: extra number of sampling points
76             curve, cloud: list of coordinates
78     @param surfaces : list of surfaces to sample, choice of \n
79       - plane : values on plane defined by point, normal.
80       - patch : values on patch.
82 Notes
83     Runs in parallel
85 \*---------------------------------------------------------------------------*/
87 #include "argList.H"
88 #include "timeSelector.H"
89 #include "IOsampledSets.H"
90 #include "IOsampledSurfaces.H"
92 using namespace Foam;
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 // Main program:
97 int main(int argc, char *argv[])
99     timeSelector::addOptions();
100 #   include "addRegionOption.H"
101 #   include "setRootCase.H"
102 #   include "createTime.H"
103     instantList timeDirs = timeSelector::select0(runTime, args);
104 #   include "createNamedMesh.H"
106     IOsampledSets sSets
107     (
108         sampledSets::typeName,
109         mesh,
110         "sampleDict",
111         IOobject::MUST_READ,
112         true
113     );
115     IOsampledSurfaces sSurfs
116     (
117         sampledSurfaces::typeName,
118         mesh,
119         "sampleDict",
120         IOobject::MUST_READ,
121         true
122     );
124     forAll(timeDirs, timeI)
125     {
126         runTime.setTime(timeDirs[timeI], timeI);
127         Info<< "Time = " << runTime.timeName() << endl;
129         // Handle geometry/topology changes
130         polyMesh::readUpdateState state = mesh.readUpdate();
132         sSets.readUpdate(state);
133         sSurfs.readUpdate(state);
135         sSets.write();
136         sSurfs.write();
138         Info<< endl;
139     }
141     Info<< "End\n" << endl;
143     return 0;
147 // ************************************************************************* //