CppNoddy
0.92
|
A two dimensional mesh utility object. More...
#include <TwoD_Node_Mesh.h>
Public Member Functions | |
TwoD_Node_Mesh () | |
TwoD_Node_Mesh (const DenseVector< double > &x_nodes, const DenseVector< double > &y_nodes, const std::size_t nvars) | |
ctor More... | |
TwoD_Node_Mesh (const double left, const double right, const double bottom, const double top, const std::size_t nx, const std::size_t ny, const std::size_t nvars) | |
ctor More... | |
TwoD_Node_Mesh (std::string filename, const std::size_t nx, const std::size_t ny, const std::size_t nv) | |
virtual | ~TwoD_Node_Mesh () |
dtor More... | |
DenseVector< _Type > | operator() (const std::size_t nodex, const std::size_t nodey) |
Access operator for a nodal point that returns a vector. More... | |
_Type & | operator() (const std::size_t nodex, const std::size_t nodey, const std::size_t var) |
Access operator for a nodal point/variable in the mesh. More... | |
const _Type & | operator() (const std::size_t nodex, const std::size_t nodey, const std::size_t var) const |
Const access operator for a nodal point/variable in the mesh. More... | |
std::pair< double, double > | coord (const std::size_t nodex, const std::size_t nodey) const |
Access the nodal position - as a pair. More... | |
double & | xcoord (const std::size_t nodex) |
Access the x-nodal (first index) position. More... | |
double & | ycoord (const std::size_t nodey) |
Access the y-nodal (second index) position. More... | |
void | set_nodes_vars (const std::size_t nodex, const std::size_t nodey, const DenseVector< _Type > &U) |
Set the variables stored at A SPECIFIED node. More... | |
DenseVector< _Type > | get_nodes_vars (const std::size_t nodex, const std::size_t nodey) const |
Get the variables stored at A SPECIFIED node – equivalent to mesh(nodex,nodey). More... | |
OneD_Node_Mesh< _Type > | get_xsection_at_xnode (const std::size_t nodex) const |
Get a cross section of the 2D mesh at a specified (constant) x node. More... | |
OneD_Node_Mesh< _Type > | get_xsection_at_ynode (const std::size_t nodey) const |
Get a cross section of the 2D mesh at a specified (constant) y node. More... | |
OneD_Node_Mesh< _Type > | get_xsection_at_x1 (const double x) const |
Get a cross section of the 2D mesh at a specified (constant) x node. More... | |
void | assign (const _Type elt) |
Assign an element to all entries in the mesh. More... | |
std::pair< std::size_t, std::size_t > | get_nnodes () const |
Get the number of nodes in the two directions of the 2D mesh. More... | |
std::size_t | get_nvars () const |
Get the number of variables that are stored at each node. More... | |
const DenseVector< double > & | xnodes () const |
Access the vector of x-nodal positions. More... | |
const DenseVector< double > & | ynodes () const |
Access the vector of y-nodal positions. More... | |
DenseMatrix< _Type > | get_var_as_matrix (std::size_t var) const |
Return a matrix corresponding to each nodal point in the mesh Each matrix element will contain a specified variable number. More... | |
void | remesh1 (const DenseVector< double > &newX, const DenseVector< double > &newY) |
Interpolate this mesh data (bilinearly) into a new mesh with nodal points defined in the argument list. More... | |
void | dump () const |
A simple method for dumping data to std::cout. More... | |
void | dump (std::string filename) const |
A simple method for dumping data to a file. More... | |
void | dump_var (std::string filename, const unsigned var) const |
A simple method for dumping a single variable to a file with no nodal information. More... | |
void | read (std::string filename, const bool reset=false) |
A simple method for reading data from a file. More... | |
void | dump_gnu (std::string filename) const |
A simple method for dumping data to a file for gnuplot surface plotting. More... | |
void | normalise (const std::size_t &var) |
Normalise all data in the mesh based on one variable. More... | |
void | scale (const _Type &value) |
Calls the vector "scale" method for the whole mesh data. More... | |
void | normalise_real_part (const std::size_t &var) |
Normalise the mesh such that the real part of variable 'var' has a real part of unity, and is then the largest real part across the whole mesh. More... | |
double | max_abs_real_part (unsigned var) |
Find the maximum stored absolute value in the mesh for a given variable – no interpolation is used. More... | |
double | max_abs (unsigned var) |
Find the maximum stored absolute value in the mesh for a given variable – no interpolation is used. More... | |
DenseVector< _Type > | get_interpolated_vars (const double &x, const double &y) |
Get a bilinearly interpolated value at a specified point. More... | |
void | normalise (const std::size_t &var) |
void | normalise (const std::size_t &var) |
double | max_abs_real_part (unsigned var) |
double | max_abs_real_part (unsigned var) |
void | dump_gnu (std::string filename) const |
void | dump_gnu (std::string filename) const |
void | read (std::string filename, bool reset) |
void | read (std::string filename, bool reset) |
Protected Attributes | |
std::size_t | m_nx |
std::size_t | m_ny |
std::size_t | m_nv |
DenseVector< double > | m_X |
DenseVector< double > | m_Y |
DenseVector< _Type > | m_vars |
A two dimensional mesh utility object.
Definition at line 19 of file TwoD_Node_Mesh.h.
|
inline |
Definition at line 22 of file TwoD_Node_Mesh.h.
|
inline |
ctor
Definition at line 26 of file TwoD_Node_Mesh.h.
References CppNoddy::TwoD_Node_Mesh< _Type >::m_nv, CppNoddy::TwoD_Node_Mesh< _Type >::m_nx, CppNoddy::TwoD_Node_Mesh< _Type >::m_ny, and CppNoddy::TwoD_Node_Mesh< _Type >::m_vars.
|
inline |
ctor
Definition at line 34 of file TwoD_Node_Mesh.h.
References CppNoddy::TwoD_Node_Mesh< _Type >::m_nv, CppNoddy::TwoD_Node_Mesh< _Type >::m_nx, CppNoddy::TwoD_Node_Mesh< _Type >::m_ny, CppNoddy::TwoD_Node_Mesh< _Type >::m_vars, CppNoddy::TwoD_Node_Mesh< _Type >::m_X, CppNoddy::TwoD_Node_Mesh< _Type >::m_Y, CppNoddy::DenseVector< _Type >::push_back(), and CppNoddy::DenseVector< _Type >::reserve().
|
inline |
Definition at line 56 of file TwoD_Node_Mesh.h.
References CppNoddy::TwoD_Node_Mesh< _Type >::m_vars, CppNoddy::TwoD_Node_Mesh< _Type >::m_X, CppNoddy::TwoD_Node_Mesh< _Type >::m_Y, and CppNoddy::TwoD_Node_Mesh< _Type >::read().
|
inlinevirtual |
void CppNoddy::TwoD_Node_Mesh< _Type >::assign | ( | const _Type | elt | ) |
|
inline |
Access the nodal position - as a pair.
nodex | The x nodal position to return |
nodey | The y nodal position to return |
Definition at line 369 of file TwoD_Node_Mesh.h.
Referenced by main().
void CppNoddy::TwoD_Node_Mesh< _Type >::dump |
A simple method for dumping data to std::cout.
Definition at line 318 of file TwoD_Node_Mesh.cpp.
void CppNoddy::TwoD_Node_Mesh< _Type >::dump | ( | std::string | filename | ) | const |
A simple method for dumping data to a file.
filename | The filename to write the data to (will overwrite) |
Definition at line 461 of file TwoD_Node_Mesh.cpp.
void CppNoddy::TwoD_Node_Mesh< _Type >::dump_gnu | ( | std::string | filename | ) | const |
A simple method for dumping data to a file for gnuplot surface plotting.
filename | The filename to write the data to (will overwrite) |
Referenced by main().
void CppNoddy::TwoD_Node_Mesh< double >::dump_gnu | ( | std::string | filename | ) | const |
void CppNoddy::TwoD_Node_Mesh< D_complex >::dump_gnu | ( | std::string | filename | ) | const |
Definition at line 423 of file TwoD_Node_Mesh.cpp.
void CppNoddy::TwoD_Node_Mesh< _Type >::dump_var | ( | std::string | filename, |
const unsigned | var | ||
) | const |
A simple method for dumping a single variable to a file with no nodal information.
filename | The filename to write the data to (will overwrite) |
var | The index of the variable to be dumped to output |
Definition at line 446 of file TwoD_Node_Mesh.cpp.
|
inline |
Get a bilinearly interpolated value at a specified point.
x | x-coordinate in the 2D mesh |
y | y-coordinate in the 2D mesh |
Definition at line 255 of file TwoD_Node_Mesh.h.
References CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::get_interpolated_vars(), CppNoddy::TwoD_Node_Mesh< _Type >::get_xsection_at_ynode(), CppNoddy::TwoD_Node_Mesh< _Type >::m_nx, CppNoddy::TwoD_Node_Mesh< _Type >::m_ny, CppNoddy::TwoD_Node_Mesh< _Type >::m_X, and CppNoddy::TwoD_Node_Mesh< _Type >::m_Y.
std::pair< std::size_t, std::size_t > CppNoddy::TwoD_Node_Mesh< _Type >::get_nnodes |
Get the number of nodes in the two directions of the 2D mesh.
Definition at line 57 of file TwoD_Node_Mesh.cpp.
Referenced by CppNoddy::FT::idft_with_ishift().
DenseVector< _Type > CppNoddy::TwoD_Node_Mesh< _Type >::get_nodes_vars | ( | const std::size_t | nodex, |
const std::size_t | nodey | ||
) | const |
Get the variables stored at A SPECIFIED node – equivalent to mesh(nodex,nodey).
nodex | The x nodal index to be returned |
nodey | The y nodal index to be returned |
Definition at line 37 of file TwoD_Node_Mesh.cpp.
std::size_t CppNoddy::TwoD_Node_Mesh< _Type >::get_nvars |
Get the number of variables that are stored at each node.
Definition at line 65 of file TwoD_Node_Mesh.cpp.
Referenced by CppNoddy::FT::idft_with_ishift().
DenseMatrix< _Type > CppNoddy::TwoD_Node_Mesh< _Type >::get_var_as_matrix | ( | std::size_t | var | ) | const |
Return a matrix corresponding to each nodal point in the mesh Each matrix element will contain a specified variable number.
var | The variable number to be accessed |
Definition at line 80 of file TwoD_Node_Mesh.cpp.
Referenced by main().
|
inline |
Get a cross section of the 2D mesh at a specified (constant) x node.
nodex | The x nodal index at which the cross section is to be taken |
Definition at line 135 of file TwoD_Node_Mesh.h.
References CppNoddy::TwoD_Node_Mesh< _Type >::m_nv, CppNoddy::TwoD_Node_Mesh< _Type >::m_nx, CppNoddy::TwoD_Node_Mesh< _Type >::m_ny, CppNoddy::TwoD_Node_Mesh< _Type >::m_X, CppNoddy::TwoD_Node_Mesh< _Type >::m_Y, and CppNoddy::TwoD_Node_Mesh< _Type >::operator()().
OneD_Node_Mesh< _Type > CppNoddy::TwoD_Node_Mesh< _Type >::get_xsection_at_xnode | ( | const std::size_t | nodex | ) | const |
Get a cross section of the 2D mesh at a specified (constant) x node.
nodex | The x nodal index at which the cross section is to be taken |
Definition at line 299 of file TwoD_Node_Mesh.cpp.
References CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::set_nodes_vars().
OneD_Node_Mesh< _Type > CppNoddy::TwoD_Node_Mesh< _Type >::get_xsection_at_ynode | ( | const std::size_t | nodey | ) | const |
Get a cross section of the 2D mesh at a specified (constant) y node.
nodey | The y nodal index at which the cross section is to be taken |
Definition at line 308 of file TwoD_Node_Mesh.cpp.
References CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::set_nodes_vars().
Referenced by CppNoddy::TwoD_Node_Mesh< _Type >::get_interpolated_vars(), and CppNoddy::FT::idft_with_ishift().
|
inline |
Find the maximum stored absolute value in the mesh for a given variable – no interpolation is used.
var | The variable index whose maximum is being asked for |
Definition at line 237 of file TwoD_Node_Mesh.h.
References CppNoddy::TwoD_Node_Mesh< _Type >::m_nv, CppNoddy::TwoD_Node_Mesh< _Type >::m_ny, CppNoddy::TwoD_Node_Mesh< _Type >::m_vars, CppNoddy::TwoD_Node_Mesh< _Type >::m_X, CppNoddy::TwoD_Node_Mesh< _Type >::m_Y, and CppNoddy::DenseVector< _Type >::size().
Referenced by main().
double CppNoddy::TwoD_Node_Mesh< _Type >::max_abs_real_part | ( | unsigned | var | ) |
Find the maximum stored absolute value in the mesh for a given variable – no interpolation is used.
var | The variable index whose maximum is being asked for |
Referenced by CppNoddy::TwoD_Node_Mesh< _Type >::normalise_real_part().
double CppNoddy::TwoD_Node_Mesh< D_complex >::max_abs_real_part | ( | unsigned | var | ) |
Definition at line 374 of file TwoD_Node_Mesh.cpp.
double CppNoddy::TwoD_Node_Mesh< double >::max_abs_real_part | ( | unsigned | var | ) |
Definition at line 388 of file TwoD_Node_Mesh.cpp.
void CppNoddy::TwoD_Node_Mesh< _Type >::normalise | ( | const std::size_t & | var | ) |
Normalise all data in the mesh based on one variable.
var | This var will have its peak (absolute) value as +/-unity following the normalisation. All other variables will also be rescaled by the same amount. |
void CppNoddy::TwoD_Node_Mesh< double >::normalise | ( | const std::size_t & | var | ) |
Definition at line 339 of file TwoD_Node_Mesh.cpp.
void CppNoddy::TwoD_Node_Mesh< D_complex >::normalise | ( | const std::size_t & | var | ) |
Definition at line 345 of file TwoD_Node_Mesh.cpp.
|
inline |
Normalise the mesh such that the real part of variable 'var' has a real part of unity, and is then the largest real part across the whole mesh.
var | The variable to be normalised |
Definition at line 224 of file TwoD_Node_Mesh.h.
References CppNoddy::TwoD_Node_Mesh< _Type >::m_vars, and CppNoddy::TwoD_Node_Mesh< _Type >::max_abs_real_part().
|
inline |
Access operator for a nodal point that returns a vector.
nodex | The nodal index value in the first direction |
nodey | The nodal index value in the second direction |
Definition at line 317 of file TwoD_Node_Mesh.h.
Referenced by CppNoddy::TwoD_Node_Mesh< _Type >::get_xsection_at_x1().
|
inline |
Access operator for a nodal point/variable in the mesh.
nodex | The nodal index value in the first direction |
nodey | The nodal index value in the second direction |
var | The variable index to be accessed |
Definition at line 331 of file TwoD_Node_Mesh.h.
|
inline |
Const access operator for a nodal point/variable in the mesh.
nodex | The nodal index value in the first direction |
nodey | The nodal index value in the second direction |
var | The variable index to be accessed |
Definition at line 350 of file TwoD_Node_Mesh.h.
void CppNoddy::TwoD_Node_Mesh< double >::read | ( | std::string | filename, |
bool | reset | ||
) |
Definition at line 482 of file TwoD_Node_Mesh.cpp.
void CppNoddy::TwoD_Node_Mesh< D_complex >::read | ( | std::string | filename, |
bool | reset | ||
) |
Definition at line 525 of file TwoD_Node_Mesh.cpp.
void CppNoddy::TwoD_Node_Mesh< _Type >::read | ( | std::string | filename, |
const bool | reset = false |
||
) |
A simple method for reading data from a file.
filename | The filename to write the data to (will overwrite) |
reset | Will reset the nodal positions using those from the file |
Referenced by CppNoddy::TwoD_Node_Mesh< _Type >::TwoD_Node_Mesh().
void CppNoddy::TwoD_Node_Mesh< _Type >::remesh1 | ( | const DenseVector< double > & | newX, |
const DenseVector< double > & | newY | ||
) |
Interpolate this mesh data (bilinearly) into a new mesh with nodal points defined in the argument list.
Not written to be efficient, so you probably don't want to do any repeated calls with this method.
newX | The x-nodal coordinates to be used in the new mesh. |
newY | The y-nodal coordinates to be used in the new mesh. |
Definition at line 99 of file TwoD_Node_Mesh.cpp.
References CppNoddy::DenseVector< _Type >::size(), and CppNoddy::Utility::stringify().
Referenced by main().
|
inline |
Calls the vector "scale" method for the whole mesh data.
value | The value to be used in the scale operation |
Definition at line 216 of file TwoD_Node_Mesh.h.
References CppNoddy::TwoD_Node_Mesh< _Type >::m_vars.
void CppNoddy::TwoD_Node_Mesh< _Type >::set_nodes_vars | ( | const std::size_t | nodex, |
const std::size_t | nodey, | ||
const DenseVector< _Type > & | U | ||
) |
Set the variables stored at A SPECIFIED node.
nodex | The x nodal index to be set |
nodey | The y nodal index to be set |
U | The vector of VARIABLES to be written to this nodal point |
Definition at line 20 of file TwoD_Node_Mesh.cpp.
References U.
Referenced by CppNoddy::FT::dft_with_shift(), and CppNoddy::FT::idft_with_ishift().
|
inline |
Access the x-nodal (first index) position.
nodex | The x nodal index |
Definition at line 98 of file TwoD_Node_Mesh.h.
References CppNoddy::TwoD_Node_Mesh< _Type >::m_X.
Referenced by CppNoddy::FT::dft_with_shift(), and CppNoddy::FT::idft_with_ishift().
const DenseVector< double > & CppNoddy::TwoD_Node_Mesh< _Type >::xnodes |
Access the vector of x-nodal positions.
Definition at line 70 of file TwoD_Node_Mesh.cpp.
Referenced by CppNoddy::FT::idft_with_ishift().
|
inline |
Access the y-nodal (second index) position.
nodex | The y nodal index |
Definition at line 105 of file TwoD_Node_Mesh.h.
References CppNoddy::TwoD_Node_Mesh< _Type >::m_Y.
const DenseVector< double > & CppNoddy::TwoD_Node_Mesh< _Type >::ynodes |
Access the vector of y-nodal positions.
Definition at line 75 of file TwoD_Node_Mesh.cpp.
Referenced by CppNoddy::FT::idft_with_ishift().
|
protected |
Definition at line 306 of file TwoD_Node_Mesh.h.
Referenced by CppNoddy::TwoD_Node_Mesh< _Type >::get_xsection_at_x1(), CppNoddy::TwoD_Node_Mesh< _Type >::max_abs(), and CppNoddy::TwoD_Node_Mesh< _Type >::TwoD_Node_Mesh().
|
protected |
Definition at line 306 of file TwoD_Node_Mesh.h.
Referenced by CppNoddy::TwoD_Node_Mesh< _Type >::get_interpolated_vars(), CppNoddy::TwoD_Node_Mesh< _Type >::get_xsection_at_x1(), and CppNoddy::TwoD_Node_Mesh< _Type >::TwoD_Node_Mesh().
|
protected |
|
protected |
Definition at line 312 of file TwoD_Node_Mesh.h.
Referenced by CppNoddy::TwoD_Node_Mesh< _Type >::max_abs(), CppNoddy::TwoD_Node_Mesh< _Type >::normalise_real_part(), CppNoddy::TwoD_Node_Mesh< _Type >::scale(), and CppNoddy::TwoD_Node_Mesh< _Type >::TwoD_Node_Mesh().
|
protected |
Definition at line 308 of file TwoD_Node_Mesh.h.
Referenced by CppNoddy::TwoD_Node_Mesh< _Type >::get_interpolated_vars(), CppNoddy::TwoD_Node_Mesh< _Type >::get_xsection_at_x1(), CppNoddy::TwoD_Node_Mesh< _Type >::max_abs(), CppNoddy::TwoD_Node_Mesh< _Type >::TwoD_Node_Mesh(), and CppNoddy::TwoD_Node_Mesh< _Type >::xcoord().
|
protected |
Definition at line 310 of file TwoD_Node_Mesh.h.
Referenced by CppNoddy::TwoD_Node_Mesh< _Type >::get_interpolated_vars(), CppNoddy::TwoD_Node_Mesh< _Type >::get_xsection_at_x1(), CppNoddy::TwoD_Node_Mesh< _Type >::max_abs(), CppNoddy::TwoD_Node_Mesh< _Type >::TwoD_Node_Mesh(), and CppNoddy::TwoD_Node_Mesh< _Type >::ycoord().
© 2012
R.E. Hewitt