Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Public Attributes | Private Attributes | List of all members
Nektar::LibUtilities::PtsField Class Reference

#include <PtsField.h>

Collaboration diagram for Nektar::LibUtilities::PtsField:
Collaboration graph
[legend]

Public Member Functions

 PtsField (const int dim, const Array< OneD, Array< OneD, NekDouble > > &pts)
 
 PtsField (const int dim, const std::vector< std::string > fieldnames, const Array< OneD, Array< OneD, NekDouble > > &pts, std::map< PtsInfo, int > ptsInfo=NullPtsInfoMap)
 
 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)
 
void GetConnectivity (std::vector< Array< OneD, int > > &conn) const
 Set the connectivity data for ePtsTetBlock and ePtsTriBlock. More...
 
void SetConnectivity (const std::vector< Array< OneD, int > > &conn)
 Get the connectivity data for ePtsTetBlock and ePtsTriBlock. More...
 
void SetDim (const int ptsDim)
 
int GetDim () const
 
int GetNFields () const
 
std::vector< std::string > GetFieldNames () const
 
std::string GetFieldName (const int i) const
 
void SetFieldNames (const std::vector< std::string > fieldNames)
 
void AddField (const Array< OneD, NekDouble > &pts, const std::string fieldName)
 
void AddPoints (const Array< OneD, const Array< OneD, NekDouble > > &pts)
 
int GetNpoints () const
 
NekDouble GetPointVal (const int fieldInd, const int ptInd) const
 
void SetPointVal (const int fieldInd, const int ptInd, const NekDouble val)
 
void GetPts (Array< OneD, Array< OneD, NekDouble > > &pts) const
 
Array< OneD, NekDoubleGetPts (const int fieldInd) const
 
void SetPts (Array< OneD, Array< OneD, NekDouble > > &pts)
 
std::vector< int > GetPointsPerEdge () const
 
int GetPointsPerEdge (const int i) const
 
void SetPointsPerEdge (const std::vector< int > nPtsPerEdge)
 Set the number of points per edge. More...
 
PtsType GetPtsType () const
 
void SetPtsType (const PtsType type)
 
std::vector< NekDoubleGetBoxSize () const
 
void SetBoxSize (const std::vector< NekDouble > boxsize)
 

Public Attributes

std::map< PtsInfo, int > m_ptsInfo
 map for information about points that can be added through PtsInfo enum More...
 

Private Attributes

int m_dim
 Dimension of the pts field. More...
 
std::vector< std::string > m_fieldNames
 Names of the field variables. More...
 
Array< OneD, Array< OneD,
NekDouble > > 
m_pts
 Point data. For a n-dimensional field, the first m_dim fields are the points spatial coordinates. Structure: m_pts[fieldIdx][ptIdx]. More...
 
std::vector< int > m_nPtsPerEdge
 Number of points per edge. Empty if the point data has no specific shape (ePtsLine) or is a block (ePtsTetBlock, ePtsTriBlock), size=1 for ePtsLine and 2 for a ePtsPlane. More...
 
std::vector< Array< OneD, int > > m_ptsConn
 Connectivity data needed for ePtsTetBlock and ePtsTriBlock. For n Blocks with m elements each, m_ptsConn is a vector of n arrays with 3*m (ePtsTriBlock) or 4*m (ePtsTetBlock) entries. More...
 
PtsType m_ptsType
 Type of the PtsField. More...
 
std::vector< NekDoublem_boxSize
 vector of box size xmin,xmax,ymin,ymax,zmin,zmax More...
 

Detailed Description

Definition at line 73 of file PtsField.h.

Constructor & Destructor Documentation

Nektar::LibUtilities::PtsField::PtsField ( const int  dim,
const Array< OneD, Array< OneD, NekDouble > > &  pts 
)

Definition at line 46 of file PtsField.cpp.

References GetNFields(), and m_fieldNames.

48  : m_dim(dim), m_pts(pts), m_ptsType(ePtsFile)
49 {
50  for (int i = 0; i < GetNFields(); ++i)
51  {
52  m_fieldNames.push_back("NA");
53  }
54 }
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
PtsType m_ptsType
Type of the PtsField.
Definition: PtsField.h:172
int m_dim
Dimension of the pts field.
Definition: PtsField.h:157
std::vector< std::string > m_fieldNames
Names of the field variables.
Definition: PtsField.h:159
Nektar::LibUtilities::PtsField::PtsField ( const int  dim,
const std::vector< std::string >  fieldnames,
const Array< OneD, Array< OneD, NekDouble > > &  pts,
std::map< PtsInfo, int >  ptsInfo = NullPtsInfoMap 
)
inline

Definition at line 79 of file PtsField.h.

84  : m_ptsInfo(ptsInfo), m_dim(dim), m_fieldNames(fieldnames), m_pts(pts),
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
PtsType m_ptsType
Type of the PtsField.
Definition: PtsField.h:172
int m_dim
Dimension of the pts field.
Definition: PtsField.h:157
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
Nektar::LibUtilities::PtsField::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 
)
inline

Definition at line 87 of file PtsField.h.

93  : m_ptsInfo(NullPtsInfoMap), m_dim(dim), m_fieldNames(fieldnames),
94  m_pts(pts), m_ptsType(ePtsFile) {};
static std::map< PtsInfo, int > NullPtsInfoMap
Definition: PtsField.h:71
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
PtsType m_ptsType
Type of the PtsField.
Definition: PtsField.h:172
int m_dim
Dimension of the pts field.
Definition: PtsField.h:157
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

Member Function Documentation

void Nektar::LibUtilities::PtsField::AddField ( const Array< OneD, NekDouble > &  pts,
const std::string  fieldName 
)

Definition at line 120 of file PtsField.cpp.

References ASSERTL1, m_fieldNames, and m_pts.

122 {
123  int nTotvars = m_pts.num_elements();
124 
125  ASSERTL1(pts.num_elements() == m_pts[0].num_elements(),
126  "Field size mismatch");
127 
128  // redirect existing pts
129  Array<OneD, Array<OneD, NekDouble> > newpts(nTotvars + 1);
130  for (int i = 0; i < nTotvars; ++i)
131  {
132  newpts[i] = m_pts[i];
133  }
134  newpts[nTotvars] = pts;
135 
136  m_pts = newpts;
137 
138  m_fieldNames.push_back(fieldName);
139 }
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
std::vector< std::string > m_fieldNames
Names of the field variables.
Definition: PtsField.h:159
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
void Nektar::LibUtilities::PtsField::AddPoints ( const Array< OneD, const Array< OneD, NekDouble > > &  pts)

Definition at line 141 of file PtsField.cpp.

References ASSERTL1, and m_pts.

142 {
143  ASSERTL1(pts.num_elements() == m_pts.num_elements(),
144  "number of variables mismatch");
145 
146  // TODO: dont copy, dont iterate
147  for (int i = 0; i < m_pts.num_elements(); ++i)
148  {
149  Array<OneD, NekDouble> tmp(m_pts[i].num_elements() + pts[i].num_elements());
150  for (int j = 0; j < m_pts[i].num_elements(); ++j)
151  {
152  tmp[j] = m_pts[i][j];
153  }
154  for (int j = 0; j < pts[i].num_elements(); ++j)
155  {
156  tmp[m_pts[i].num_elements() + j] = pts[i][j];
157  }
158  m_pts[i] = tmp;
159  }
160 }
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
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
vector< NekDouble > Nektar::LibUtilities::PtsField::GetBoxSize ( ) const

Definition at line 233 of file PtsField.cpp.

References m_boxSize.

234 {
235  return m_boxSize;
236 }
std::vector< NekDouble > m_boxSize
vector of box size xmin,xmax,ymin,ymax,zmin,zmax
Definition: PtsField.h:175
void Nektar::LibUtilities::PtsField::GetConnectivity ( std::vector< Array< OneD, int > > &  conn) const

Set the connectivity data for ePtsTetBlock and ePtsTriBlock.

Parameters
connConnectivity data Connectivity data needed for ePtsTetBlock and ePtsTriBlock. For n Blocks with m elements each, m_ptsConn is a vector of n arrays with 3*m (ePtsTriBlock) or 4*m (ePtsTetBlock) entries.

Definition at line 64 of file PtsField.cpp.

References m_ptsConn.

65 {
66  conn = m_ptsConn;
67 }
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
int Nektar::LibUtilities::PtsField::GetDim ( ) const

Definition at line 91 of file PtsField.cpp.

References m_dim.

92 {
93  return m_dim;
94 }
int m_dim
Dimension of the pts field.
Definition: PtsField.h:157
std::string Nektar::LibUtilities::PtsField::GetFieldName ( const int  i) const

Definition at line 106 of file PtsField.cpp.

References m_fieldNames.

107 {
108  return m_fieldNames[i];
109 }
std::vector< std::string > m_fieldNames
Names of the field variables.
Definition: PtsField.h:159
vector< std::string > Nektar::LibUtilities::PtsField::GetFieldNames ( ) const

Definition at line 101 of file PtsField.cpp.

References m_fieldNames.

102 {
103  return m_fieldNames;
104 }
std::vector< std::string > m_fieldNames
Names of the field variables.
Definition: PtsField.h:159
int Nektar::LibUtilities::PtsField::GetNFields ( ) const

Definition at line 96 of file PtsField.cpp.

References m_dim, and m_pts.

Referenced by PtsField().

97 {
98  return m_pts.num_elements() - m_dim;
99 }
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
int m_dim
Dimension of the pts field.
Definition: PtsField.h:157
int Nektar::LibUtilities::PtsField::GetNpoints ( ) const

Definition at line 162 of file PtsField.cpp.

References m_pts.

163 {
164  return m_pts[0].num_elements();
165 }
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
vector< int > Nektar::LibUtilities::PtsField::GetPointsPerEdge ( ) const

Definition at line 197 of file PtsField.cpp.

References m_nPtsPerEdge.

198 {
199  return m_nPtsPerEdge;
200 }
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
int Nektar::LibUtilities::PtsField::GetPointsPerEdge ( const int  i) const

Definition at line 202 of file PtsField.cpp.

References m_nPtsPerEdge.

203 {
204  return m_nPtsPerEdge[i];
205 }
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
NekDouble Nektar::LibUtilities::PtsField::GetPointVal ( const int  fieldInd,
const int  ptInd 
) const

Definition at line 167 of file PtsField.cpp.

References m_pts.

168 {
169  return m_pts[fieldInd][ptInd];
170 }
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 Nektar::LibUtilities::PtsField::GetPts ( Array< OneD, Array< OneD, NekDouble > > &  pts) const

Definition at line 179 of file PtsField.cpp.

References m_pts.

180 {
181  pts = m_pts;
182 }
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
Array< OneD, NekDouble > Nektar::LibUtilities::PtsField::GetPts ( const int  fieldInd) const

Definition at line 184 of file PtsField.cpp.

References m_pts.

185 {
186  return m_pts[fieldInd];
187 }
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
PtsType Nektar::LibUtilities::PtsField::GetPtsType ( ) const

Definition at line 223 of file PtsField.cpp.

References m_ptsType.

224 {
225  return m_ptsType;
226 }
PtsType m_ptsType
Type of the PtsField.
Definition: PtsField.h:172
void Nektar::LibUtilities::PtsField::SetBoxSize ( const std::vector< NekDouble boxsize)

Definition at line 238 of file PtsField.cpp.

References m_boxSize.

239 {
240  m_boxSize = boxSize;
241 }
std::vector< NekDouble > m_boxSize
vector of box size xmin,xmax,ymin,ymax,zmin,zmax
Definition: PtsField.h:175
void Nektar::LibUtilities::PtsField::SetConnectivity ( const std::vector< Array< OneD, int > > &  conn)

Get the connectivity data for ePtsTetBlock and ePtsTriBlock.

Parameters
connConnectivity data Connectivity data needed for ePtsTetBlock and ePtsTriBlock. For n Blocks with m elements each, m_ptsConn is a vector of n arrays with 3*m (ePtsTriBlock) or 4*m (ePtsTetBlock) entries.

Definition at line 77 of file PtsField.cpp.

References ASSERTL1, Nektar::LibUtilities::ePtsSegBlock, Nektar::LibUtilities::ePtsTetBlock, Nektar::LibUtilities::ePtsTriBlock, m_ptsConn, and m_ptsType.

78 {
81  "ptsType must be set before connectivity");
82 
83  m_ptsConn = conn;
84 }
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
PtsType m_ptsType
Type of the PtsField.
Definition: PtsField.h:172
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
void Nektar::LibUtilities::PtsField::SetDim ( const int  ptsDim)

Definition at line 86 of file PtsField.cpp.

References m_dim.

87 {
88  m_dim = ptsDim;
89 }
int m_dim
Dimension of the pts field.
Definition: PtsField.h:157
void Nektar::LibUtilities::PtsField::SetFieldNames ( const std::vector< std::string >  fieldNames)

Definition at line 111 of file PtsField.cpp.

References ASSERTL0, m_dim, m_fieldNames, and m_pts.

112 {
113  ASSERTL0(fieldNames.size() == m_pts.num_elements() - m_dim,
114  "Number of given fieldNames does not match the number of stored "
115  "fields");
116 
117  m_fieldNames = fieldNames;
118 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
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
int m_dim
Dimension of the pts field.
Definition: PtsField.h:157
std::vector< std::string > m_fieldNames
Names of the field variables.
Definition: PtsField.h:159
void Nektar::LibUtilities::PtsField::SetPointsPerEdge ( const std::vector< int >  nPtsPerEdge)

Set the number of points per edge.

Parameters
nPtsPerEdgeNumber of points per edge. Empty if the point data has no specific shape (ePtsLine) or is a block (ePtsTetBlock, ePtsTriBlock), size=1 for ePtsLine, 2 for ePtsPlane and 3 for ePtsBox

Definition at line 214 of file PtsField.cpp.

References ASSERTL0, Nektar::LibUtilities::ePtsBox, Nektar::LibUtilities::ePtsLine, Nektar::LibUtilities::ePtsPlane, m_nPtsPerEdge, and m_ptsType.

215 {
216  ASSERTL0(
218  "SetPointsPerEdge only supported for ePtsLine, ePtsPlane and ePtsBox.");
219 
220  m_nPtsPerEdge = nPtsPerEdge;
221 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
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
PtsType m_ptsType
Type of the PtsField.
Definition: PtsField.h:172
void Nektar::LibUtilities::PtsField::SetPointVal ( const int  fieldInd,
const int  ptInd,
const NekDouble  val 
)

Definition at line 172 of file PtsField.cpp.

References m_pts.

175 {
176  m_pts[fieldInd][ptInd] = val;
177 }
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 Nektar::LibUtilities::PtsField::SetPts ( Array< OneD, Array< OneD, NekDouble > > &  pts)

Definition at line 189 of file PtsField.cpp.

References ASSERTL1, and m_pts.

190 {
191  ASSERTL1(pts.num_elements() == m_pts.num_elements(),
192  "Pts field count mismatch");
193 
194  m_pts = pts;
195 }
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
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
void Nektar::LibUtilities::PtsField::SetPtsType ( const PtsType  type)

Definition at line 228 of file PtsField.cpp.

References m_ptsType.

229 {
230  m_ptsType = type;
231 }
PtsType m_ptsType
Type of the PtsField.
Definition: PtsField.h:172

Member Data Documentation

std::vector<NekDouble> Nektar::LibUtilities::PtsField::m_boxSize
private

vector of box size xmin,xmax,ymin,ymax,zmin,zmax

Definition at line 175 of file PtsField.h.

Referenced by GetBoxSize(), and SetBoxSize().

int Nektar::LibUtilities::PtsField::m_dim
private

Dimension of the pts field.

Definition at line 157 of file PtsField.h.

Referenced by GetDim(), GetNFields(), SetDim(), and SetFieldNames().

std::vector<std::string> Nektar::LibUtilities::PtsField::m_fieldNames
private

Names of the field variables.

Definition at line 159 of file PtsField.h.

Referenced by AddField(), GetFieldName(), GetFieldNames(), PtsField(), and SetFieldNames().

std::vector<int> Nektar::LibUtilities::PtsField::m_nPtsPerEdge
private

Number of points per edge. Empty if the point data has no specific shape (ePtsLine) or is a block (ePtsTetBlock, ePtsTriBlock), size=1 for ePtsLine and 2 for a ePtsPlane.

Definition at line 166 of file PtsField.h.

Referenced by GetPointsPerEdge(), and SetPointsPerEdge().

Array<OneD, Array<OneD, NekDouble> > Nektar::LibUtilities::PtsField::m_pts
private

Point data. For a n-dimensional field, the first m_dim fields are the points spatial coordinates. Structure: m_pts[fieldIdx][ptIdx].

Definition at line 162 of file PtsField.h.

Referenced by AddField(), AddPoints(), GetNFields(), GetNpoints(), GetPointVal(), GetPts(), SetFieldNames(), SetPointVal(), and SetPts().

std::vector<Array<OneD, int> > Nektar::LibUtilities::PtsField::m_ptsConn
private

Connectivity data needed for ePtsTetBlock and ePtsTriBlock. For n Blocks with m elements each, m_ptsConn is a vector of n arrays with 3*m (ePtsTriBlock) or 4*m (ePtsTetBlock) entries.

Definition at line 170 of file PtsField.h.

Referenced by GetConnectivity(), and SetConnectivity().

std::map<PtsInfo, int> Nektar::LibUtilities::PtsField::m_ptsInfo

map for information about points that can be added through PtsInfo enum

Definition at line 153 of file PtsField.h.

PtsType Nektar::LibUtilities::PtsField::m_ptsType
private

Type of the PtsField.

Definition at line 172 of file PtsField.h.

Referenced by GetPtsType(), SetConnectivity(), SetPointsPerEdge(), and SetPtsType().