FreeFOAM The Cross-Platform CFD Toolkit
coordSet.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::coordSet
26 
27 Description
28  Holds list of sampling positions
29 
30 SourceFiles
31  coordSet.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef coordSet_H
36 #define coordSet_H
37 
38 #include <OpenFOAM/pointField.H>
39 #include <OpenFOAM/word.H>
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class coordSet Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class coordSet
51 :
52  public pointField
53 {
54 
55 protected:
56 
57  //- Name
58  const word name_;
59 
60  //- Axis write type
61  const word axis_;
62 
63  //- Reference point for "distance" write specifier.
65 
66 public:
67 
68  // Constructors
69 
70  //- Construct from components
71  coordSet
72  (
73  const word& name,
74  const word& axis
75  );
76 
77 
78  //- Construct from components
79  coordSet
80  (
81  const word& name,
82  const word& axis,
83  const List<point>& points,
84  const point& refPoint = point::zero
85  );
86 
87  //- Construct from components
88  coordSet
89  (
90  const word& name,
91  const word& axis,
92  const scalarField& points,
93  const scalar refPoint = 0.0
94  );
95 
96 
97  // Member functions
98 
99  const word& name() const
100  {
101  return name_;
102  }
103 
104  const word& axis() const
105  {
106  return axis_;
107  }
108 
109  const point& refPoint() const
110  {
111  return refPoint_;
112  }
113 
114  //- Is axis specification a vector
115  bool hasVectorAxis() const;
116 
117  //- Get coordinate of point according to axis specification.
118  // If axis="distance" can be: -distance to starting point (e.g.
119  // uniformSet) or -distance to first sampling point
120  // (e.g. cloudSet)
121  scalar scalarCoord
122  (
123  const label index
124  ) const;
125 
126  //- Get point according to axis="full" specification
128  (
129  const label index
130  ) const;
131 
132  Ostream& write(Ostream& os) const;
133 };
134 
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 } // End namespace Foam
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************ vim: set sw=4 sts=4 et: ************************ //