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) 2011-2012 OpenFOAM Foundation
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 "pointField.H"
39 #include "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 public:
56 
57  // Public data types
58 
59  //- Enumeration defining the output format for coordinates
60  enum coordFormat
61  {
62  XYZ,
63  X,
64  Y,
65  Z,
66  DISTANCE
67  };
68 
69 
70 private:
71 
72  //- String representation of coordFormat enums
74 
75 
76 protected:
77 
78  //- Name
79  const word name_;
80 
81  //- Axis write type
82  const coordFormat axis_;
83 
84  //- Cumulative distance "distance" write specifier.
86 
87 
88 public:
89 
90  // Constructors
91 
92  //- Construct from components
93  coordSet
94  (
95  const word& name,
96  const word& axis
97  );
98 
99 
100  //- Construct from components
101  coordSet
102  (
103  const word& name,
104  const word& axis,
105  const List<point>& points,
106  const scalarList& curveDist
107  );
108 
109 
110  // Member functions
111 
112  const word& name() const
113  {
114  return name_;
115  }
116 
117  word axis() const
118  {
119  return coordFormatNames_[axis_];
120  }
121 
122  //- Cumulative distance
123  const scalarList& curveDist() const
124  {
125  return curveDist_;
126  }
127 
128  //- Is axis specification a vector
129  bool hasVectorAxis() const;
130 
131  //- Get coordinate of point according to axis specification.
132  // If axis="distance" is the curveDist[index]
133  scalar scalarCoord(const label index) const;
134 
135  //- Get point according to axis="xyz" specification
136  vector vectorCoord(const label index) const;
137 
138  Ostream& write(Ostream& os) const;
139 };
140 
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 } // End namespace Foam
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************************************************************* //
Foam::coordSet::Y
@ Y
Definition: coordSet.H:63
Foam::coordSet::name
const word & name() const
Definition: coordSet.H:111
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::coordSet::name_
const word name_
Name.
Definition: coordSet.H:78
Foam::coordSet::coordFormat
coordFormat
Enumeration defining the output format for coordinates.
Definition: coordSet.H:59
Foam::coordSet::scalarCoord
scalar scalarCoord(const label index) const
Get coordinate of point according to axis specification.
Definition: coordSet.C:93
Foam::coordSet::axis
word axis() const
Definition: coordSet.H:116
Foam::coordSet::DISTANCE
@ DISTANCE
Definition: coordSet.H:65
Foam::coordSet::coordSet
coordSet(const word &name, const word &axis)
Construct from components.
Definition: coordSet.C:56
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::coordSet::coordFormatNames_
static const NamedEnum< coordFormat, 5 > coordFormatNames_
String representation of coordFormat enums.
Definition: coordSet.H:72
Foam::coordSet::curveDist
const scalarList & curveDist() const
Cumulative distance.
Definition: coordSet.H:122
Foam::coordSet::axis_
const coordFormat axis_
Axis write type.
Definition: coordSet.H:81
Foam::coordSet
Holds list of sampling positions.
Definition: coordSet.H:49
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::coordSet::curveDist_
scalarList curveDist_
Cumulative distance "distance" write specifier.
Definition: coordSet.H:84
pointField.H
Foam::Vector< scalar >
Foam::coordSet::write
Ostream & write(Ostream &os) const
Definition: coordSet.C:136
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::coordSet::vectorCoord
vector vectorCoord(const label index) const
Get point according to axis="xyz" specification.
Definition: coordSet.C:128
Foam::coordSet::hasVectorAxis
bool hasVectorAxis() const
Is axis specification a vector.
Definition: coordSet.C:86
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
word.H
Foam::coordSet::Z
@ Z
Definition: coordSet.H:64
Foam::coordSet::X
@ X
Definition: coordSet.H:62
Foam::coordSet::XYZ
@ XYZ
Definition: coordSet.H:61
Foam::NamedEnum< coordFormat, 5 >