Nektar++
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// Permission is hereby granted, free of charge, to any person obtaining a
15// copy of this software and associated documentation files (the "Software"),
16// to deal in the Software without restriction, including without limitation
17// the rights to use, copy, modify, merge, publish, distribute, sublicense,
18// and/or sell copies of the Software, and to permit persons to whom the
19// Software is furnished to do so, subject to the following conditions:
20//
21// The above copyright notice and this permission notice shall be included
22// in all copies or substantial portions of the Software.
23//
24// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30// DEALINGS IN THE SOFTWARE.
31//
32// Description: Pts field
33//
34///////////////////////////////////////////////////////////////////////////////
35
36#ifndef NEKTAR_LIB_UTILITIES_BASIC_UTILS_PTSFIELD_H
37#define NEKTAR_LIB_UTILITIES_BASIC_UTILS_PTSFIELD_H
38
39#include <memory>
40#include <vector>
41
42#include <boost/core/ignore_unused.hpp>
43
47
48namespace Nektar
49{
50namespace LibUtilities
51{
52
54{
62};
63
65{
68};
69
70static std::map<PtsInfo, int> NullPtsInfoMap;
71
73{
74public:
76 const int dim, const Array<OneD, Array<OneD, NekDouble>> &pts);
77
79 const int dim, const std::vector<std::string> fieldnames,
81 std::map<PtsInfo, int> ptsInfo = NullPtsInfoMap)
82 : m_ptsInfo(ptsInfo), m_dim(dim), m_fieldNames(fieldnames), m_pts(pts),
84
86 const int dim, const std::vector<std::string> fieldnames,
88 const Array<OneD, Array<OneD, float>> &weights,
89 const Array<OneD, Array<OneD, unsigned int>> &neighInds)
90 : m_ptsInfo(NullPtsInfoMap), m_dim(dim), m_fieldNames(fieldnames),
92 {
93 boost::ignore_unused(weights, neighInds);
94 };
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 size_t GetDim() const;
105
106 LIB_UTILITIES_EXPORT size_t 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
118 LIB_UTILITIES_EXPORT void RemoveField(const std::string fieldName);
119
121 const Array<OneD, const Array<OneD, NekDouble>> &pts);
122
123 LIB_UTILITIES_EXPORT size_t GetNpoints() const;
124
125 LIB_UTILITIES_EXPORT NekDouble GetPointVal(const size_t fieldInd,
126 const size_t ptInd) const;
127
128 LIB_UTILITIES_EXPORT void SetPointVal(const size_t fieldInd,
129 const size_t ptInd,
130 const NekDouble val);
131
133 Array<OneD, Array<OneD, NekDouble>> &pts) const;
134
136 const int fieldInd) const;
137
139
140 LIB_UTILITIES_EXPORT void SetPts(const int fldId,
142
143 LIB_UTILITIES_EXPORT std::vector<size_t> GetPointsPerEdge() const;
144
145 LIB_UTILITIES_EXPORT size_t GetPointsPerEdge(const size_t i) const;
146
148 const std::vector<size_t> nPtsPerEdge);
149
151 const std::vector<int> nPtsPerElement);
152
153 LIB_UTILITIES_EXPORT std::vector<int> GetPointsPerElement() const;
154
156
157 LIB_UTILITIES_EXPORT void SetPtsType(const PtsType type);
158
159 LIB_UTILITIES_EXPORT std::vector<NekDouble> GetBoxSize() const;
160
161 LIB_UTILITIES_EXPORT void SetBoxSize(const std::vector<NekDouble> boxsize);
162
163 /// map for information about points that can be added through PtsInfo enum
164 std::map<PtsInfo, int> m_ptsInfo;
165
166private:
167 /// Dimension of the pts field
168 size_t m_dim;
169 /// Names of the field variables
170 std::vector<std::string> m_fieldNames;
171 /// Point data. For a n-dimensional field, the first m_dim fields are the
172 /// points spatial coordinates. Structure: m_pts[fieldIdx][ptIdx]
174 /// Number of points per edge. Empty if the point data has no
175 /// specific shape (ePtsLine) or is a block (ePtsTetBlock,
176 /// ePtsTriBlock), size=1 for ePtsLine and 2 for a ePtsPlane
177 std::vector<size_t> m_nPtsPerEdge;
178 std::vector<int> m_nPtsPerElement;
179 /// Connectivity data needed for ePtsTetBlock and ePtsTriBlock. For n
180 /// Blocks with m elements each, m_ptsConn is a vector of n arrays with
181 /// 3*m (ePtsTriBlock) or 4*m (ePtsTetBlock) entries.
182 std::vector<Array<OneD, int>> m_ptsConn;
183 /// Type of the PtsField
185
186 /// vector of box size xmin,xmax,ymin,ymax,zmin,zmax
187 std::vector<NekDouble> m_boxSize;
188};
189
190typedef std::shared_ptr<PtsField> PtsFieldSharedPtr;
192} // namespace LibUtilities
193} // namespace Nektar
194
195#endif
#define LIB_UTILITIES_EXPORT
std::vector< int > GetPointsPerElement() const
Definition: PtsField.cpp:246
void SetBoxSize(const std::vector< NekDouble > boxsize)
Definition: PtsField.cpp:271
NekDouble GetPointVal(const size_t fieldInd, const size_t ptInd) const
Definition: PtsField.cpp:185
std::vector< std::string > GetFieldNames() const
Definition: PtsField.cpp:100
std::vector< size_t > GetPointsPerEdge() const
Definition: PtsField.cpp:220
void SetFieldNames(const std::vector< std::string > fieldNames)
Definition: PtsField.cpp:110
std::vector< Array< OneD, int > > m_ptsConn
Connectivity data needed for ePtsTetBlock and ePtsTriBlock. For n Blocks with m elements each,...
Definition: PtsField.h:182
void SetPointVal(const size_t fieldInd, const size_t ptInd, const NekDouble val)
Definition: PtsField.cpp:190
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:78
void SetDim(const int ptsDim)
Definition: PtsField.cpp:85
PtsField(const int dim, const Array< OneD, Array< OneD, NekDouble > > &pts)
Definition: PtsField.cpp:45
std::vector< NekDouble > GetBoxSize() const
Definition: PtsField.cpp:266
size_t m_dim
Dimension of the pts field.
Definition: PtsField.h:168
std::vector< size_t > 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:177
std::vector< int > m_nPtsPerElement
Definition: PtsField.h:178
std::string GetFieldName(const int i) const
Definition: PtsField.cpp:105
void SetPointsPerElement(const std::vector< int > nPtsPerElement)
Definition: PtsField.cpp:251
void GetConnectivity(std::vector< Array< OneD, int > > &conn) const
Set the connectivity data for ePtsTetBlock and ePtsTriBlock.
Definition: PtsField.cpp:63
PtsType m_ptsType
Type of the PtsField.
Definition: PtsField.h:184
std::vector< std::string > m_fieldNames
Names of the field variables.
Definition: PtsField.h:170
std::vector< NekDouble > m_boxSize
vector of box size xmin,xmax,ymin,ymax,zmin,zmax
Definition: PtsField.h:187
void SetPts(Array< OneD, Array< OneD, NekDouble > > &pts)
Definition: PtsField.cpp:206
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:173
void SetConnectivity(const std::vector< Array< OneD, int > > &conn)
Get the connectivity data for ePtsTetBlock and ePtsTriBlock.
Definition: PtsField.cpp:76
std::map< PtsInfo, int > m_ptsInfo
map for information about points that can be added through PtsInfo enum
Definition: PtsField.h:164
void RemoveField(const std::string fieldName)
Definition: PtsField.cpp:139
void SetPointsPerEdge(const std::vector< size_t > nPtsPerEdge)
Set the number of points per edge.
Definition: PtsField.cpp:237
void SetPtsType(const PtsType type)
Definition: PtsField.cpp:261
void AddPoints(const Array< OneD, const Array< OneD, NekDouble > > &pts)
Definition: PtsField.cpp:160
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:85
void GetPts(Array< OneD, Array< OneD, NekDouble > > &pts) const
Definition: PtsField.cpp:196
void AddField(const Array< OneD, NekDouble > &pts, const std::string fieldName)
Definition: PtsField.cpp:119
static std::map< PtsInfo, int > NullPtsInfoMap
Definition: PtsField.h:70
std::shared_ptr< PtsField > PtsFieldSharedPtr
Definition: PtsField.h:190
static PtsFieldSharedPtr NullPtsField
Definition: PtsField.h:191
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble