Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PtsField.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File PtsField.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2014 Kilian Lackhove
10 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
11 // Department of Aeronautics, Imperial College London (UK), and Scientific
12 // Computing and Imaging Institute, University of Utah (USA).
13 //
14 // License for the specific language governing rights and limitations under
15 // Permission is hereby granted, free of charge, to any person obtaining a
16 // copy of this software and associated documentation files (the "Software"),
17 // to deal in the Software without restriction, including without limitation
18 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 // and/or sell copies of the Software, and to permit persons to whom the
20 // Software is furnished to do so, subject to the following conditions:
21 //
22 // The above copyright notice and this permission notice shall be included
23 // in all copies or substantial portions of the Software.
24 //
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
28 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
31 // DEALINGS IN THE SOFTWARE.
32 //
33 // Description: Pts field
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef NEKTAR_LIB_UTILITIES_BASIC_UTILS_PTSFIELD_H
38 #define NEKTAR_LIB_UTILITIES_BASIC_UTILS_PTSFIELD_H
39 
40 #include <vector>
41 
42 #include <boost/shared_ptr.hpp>
43 #include <boost/function.hpp>
44 
48 
49 namespace Nektar
50 {
51 namespace LibUtilities
52 {
53 
54 enum PtsType
55 {
63 };
64 
65 enum PtsInfo
66 {
69 };
70 
71 static std::map<PtsInfo, int> NullPtsInfoMap;
72 
73 class PtsField
74 {
75 public:
77  const int dim, const Array<OneD, Array<OneD, NekDouble> > &pts);
78 
80  const int dim,
81  const std::vector<std::string> fieldnames,
82  const Array<OneD, Array<OneD, NekDouble> > &pts,
83  std::map<PtsInfo, int> ptsInfo = NullPtsInfoMap)
84  : m_ptsInfo(ptsInfo), m_dim(dim), m_fieldNames(fieldnames), m_pts(pts),
86 
88  const int dim,
89  const std::vector<std::string> fieldnames,
90  const Array<OneD, Array<OneD, NekDouble> > &pts,
91  const Array<OneD, Array<OneD, float> > &weights,
92  const Array<OneD, Array<OneD, unsigned int> > &neighInds)
93  : m_ptsInfo(NullPtsInfoMap), m_dim(dim), m_fieldNames(fieldnames),
94  m_pts(pts), m_ptsType(ePtsFile) {};
95 
97  std::vector<Array<OneD, int> > &conn) const;
98 
100  const std::vector<Array<OneD, int> > &conn);
101 
102  LIB_UTILITIES_EXPORT void SetDim(const int ptsDim);
103 
104  LIB_UTILITIES_EXPORT int GetDim() const;
105 
106  LIB_UTILITIES_EXPORT int GetNFields() const;
107 
108  LIB_UTILITIES_EXPORT std::vector<std::string> GetFieldNames() const;
109 
110  LIB_UTILITIES_EXPORT std::string GetFieldName(const int i) const;
111 
113  const std::vector<std::string> fieldNames);
114 
116  const std::string fieldName);
117 
119 
120  LIB_UTILITIES_EXPORT int GetNpoints() const;
121 
122  LIB_UTILITIES_EXPORT NekDouble GetPointVal(const int fieldInd,
123  const int ptInd) const;
124 
125  LIB_UTILITIES_EXPORT void SetPointVal(const int fieldInd,
126  const int ptInd,
127  const NekDouble val);
128 
130  Array<OneD, Array<OneD, NekDouble> > &pts) const;
131 
133  const int fieldInd) const;
134 
136 
137  LIB_UTILITIES_EXPORT std::vector<int> GetPointsPerEdge() const;
138 
139  LIB_UTILITIES_EXPORT int GetPointsPerEdge(const int i) const;
140 
142  const std::vector<int> nPtsPerEdge);
143 
145 
146  LIB_UTILITIES_EXPORT void SetPtsType(const PtsType type);
147 
148  LIB_UTILITIES_EXPORT std::vector<NekDouble> GetBoxSize() const;
149 
150  LIB_UTILITIES_EXPORT void SetBoxSize(const std::vector<NekDouble> boxsize);
151 
152  /// map for information about points that can be added through PtsInfo enum
153  std::map<PtsInfo, int> m_ptsInfo;
154 
155 private:
156  /// Dimension of the pts field
157  int m_dim;
158  /// Names of the field variables
159  std::vector<std::string> m_fieldNames;
160  /// Point data. For a n-dimensional field, the first m_dim fields are the
161  /// points spatial coordinates. Structure: m_pts[fieldIdx][ptIdx]
163  /// Number of points per edge. Empty if the point data has no
164  /// specific shape (ePtsLine) or is a block (ePtsTetBlock,
165  /// ePtsTriBlock), size=1 for ePtsLine and 2 for a ePtsPlane
166  std::vector<int> m_nPtsPerEdge;
167  /// Connectivity data needed for ePtsTetBlock and ePtsTriBlock. For n
168  /// Blocks with m elements each, m_ptsConn is a vector of n arrays with
169  /// 3*m (ePtsTriBlock) or 4*m (ePtsTetBlock) entries.
170  std::vector<Array<OneD, int> > m_ptsConn;
171  /// Type of the PtsField
173 
174  /// vector of box size xmin,xmax,ymin,ymax,zmin,zmax
175  std::vector<NekDouble> m_boxSize;
176 };
177 
178 typedef boost::shared_ptr<PtsField> PtsFieldSharedPtr;
179 static PtsFieldSharedPtr NullPtsField;
180 }
181 }
182 
183 #endif
static std::map< PtsInfo, int > NullPtsInfoMap
Definition: PtsField.h:71
std::vector< NekDouble > m_boxSize
vector of box size xmin,xmax,ymin,ymax,zmin,zmax
Definition: PtsField.h:175
void SetPointsPerEdge(const std::vector< int > nPtsPerEdge)
Set the number of points per edge.
Definition: PtsField.cpp:214
NekDouble GetPointVal(const int fieldInd, const int ptInd) const
Definition: PtsField.cpp:167
std::vector< Array< OneD, int > > m_ptsConn
Connectivity data needed for ePtsTetBlock and ePtsTriBlock. For n Blocks with m elements each...
Definition: PtsField.h:170
void SetDim(const int ptsDim)
Definition: PtsField.cpp:86
PtsField(const int dim, const Array< OneD, Array< OneD, NekDouble > > &pts)
Definition: PtsField.cpp:46
std::vector< int > m_nPtsPerEdge
Number of points per edge. Empty if the point data has no specific shape (ePtsLine) or is a block (eP...
Definition: PtsField.h:166
void AddField(const Array< OneD, NekDouble > &pts, const std::string fieldName)
Definition: PtsField.cpp:120
void SetPointVal(const int fieldInd, const int ptInd, const NekDouble val)
Definition: PtsField.cpp:172
std::vector< std::string > GetFieldNames() const
Definition: PtsField.cpp:101
std::string GetFieldName(const int i) const
Definition: PtsField.cpp:106
boost::shared_ptr< PtsField > PtsFieldSharedPtr
Definition: PtsField.h:178
void SetConnectivity(const std::vector< Array< OneD, int > > &conn)
Get the connectivity data for ePtsTetBlock and ePtsTriBlock.
Definition: PtsField.cpp:77
Array< OneD, Array< OneD, NekDouble > > m_pts
Point data. For a n-dimensional field, the first m_dim fields are the points spatial coordinates...
Definition: PtsField.h:162
void GetPts(Array< OneD, Array< OneD, NekDouble > > &pts) const
Definition: PtsField.cpp:179
PtsType m_ptsType
Type of the PtsField.
Definition: PtsField.h:172
PtsField(const int dim, const std::vector< std::string > fieldnames, const Array< OneD, Array< OneD, NekDouble > > &pts, const Array< OneD, Array< OneD, float > > &weights, const Array< OneD, Array< OneD, unsigned int > > &neighInds)
Definition: PtsField.h:87
PtsType GetPtsType() const
Definition: PtsField.cpp:223
#define LIB_UTILITIES_EXPORT
int m_dim
Dimension of the pts field.
Definition: PtsField.h:157
void GetConnectivity(std::vector< Array< OneD, int > > &conn) const
Set the connectivity data for ePtsTetBlock and ePtsTriBlock.
Definition: PtsField.cpp:64
void AddPoints(const Array< OneD, const Array< OneD, NekDouble > > &pts)
Definition: PtsField.cpp:141
PtsField(const int dim, const std::vector< std::string > fieldnames, const Array< OneD, Array< OneD, NekDouble > > &pts, std::map< PtsInfo, int > ptsInfo=NullPtsInfoMap)
Definition: PtsField.h:79
std::vector< NekDouble > GetBoxSize() const
Definition: PtsField.cpp:233
double NekDouble
std::vector< std::string > m_fieldNames
Names of the field variables.
Definition: PtsField.h:159
std::map< PtsInfo, int > m_ptsInfo
map for information about points that can be added through PtsInfo enum
Definition: PtsField.h:153
void SetPtsType(const PtsType type)
Definition: PtsField.cpp:228
static PtsFieldSharedPtr NullPtsField
Definition: PtsField.h:179
std::vector< int > GetPointsPerEdge() const
Definition: PtsField.cpp:197
void SetBoxSize(const std::vector< NekDouble > boxsize)
Definition: PtsField.cpp:238
void SetFieldNames(const std::vector< std::string > fieldNames)
Definition: PtsField.cpp:111
void SetPts(Array< OneD, Array< OneD, NekDouble > > &pts)
Definition: PtsField.cpp:189