|
CppNoddy
0.92
|
A one dimensional mesh utility object. More...
#include <OneD_Node_Mesh.h>
Public Member Functions | |
| OneD_Node_Mesh () | |
| Default constructor. More... | |
| OneD_Node_Mesh (const DenseVector< _Xtype > &nodes, const std::size_t nvars) | |
| ctor for a given nodal distribution More... | |
| template<typename _sourceType > | |
| OneD_Node_Mesh (const OneD_Node_Mesh< _sourceType > &source) | |
| implicit conversion ctor for D_complex from double data More... | |
| OneD_Node_Mesh (std::string filename, const std::size_t nnodes, const std::size_t nvars) | |
| ctor from an existing file More... | |
| virtual | ~OneD_Node_Mesh () |
| Destructor. More... | |
| _Type & | operator() (const std::size_t i, const std::size_t var) |
| Access a variable at a node. More... | |
| const _Type & | operator() (const std::size_t i, const std::size_t var) const |
| Access a variable at a node. More... | |
| const _Xtype & | coord (const std::size_t &node) const |
| Access a nodal position. More... | |
| _Xtype & | coord (const std::size_t &node) |
| Access a nodal position. More... | |
| void | set_nodes_vars (const std::size_t node, const DenseVector< _Type > &u) |
| Set the variables stored at A SPECIFIED node. More... | |
| DenseVector< _Type > | get_nodes_vars (const std::size_t &node) const |
| Get the variables stored at A SPECIFIED node. More... | |
| DenseVector< _Type > | get_interpolated_vars (const _Xtype &pos) const |
| Get the variable data at an interpolated position using a first order scheme. More... | |
| std::size_t | get_nnodes () const |
| std::size_t | get_nvars () const |
| const DenseVector< _Xtype > & | nodes () const |
| DenseVector< double > | find_roots1 (const std::size_t &var, double value=0.0) const |
| Find a list of approximate locations at which a specified variable attains a given value. More... | |
| _Type | integral2 (std::size_t var=0) const |
| Integrate over the domain. More... | |
| _Xtype | squared_integral2 (std::size_t var=0) const |
| Compute the integral of the absolute variable squared: |variable|^2. More... | |
| _Type | integral4 (std::size_t var=0) const |
| Integrate over the domain with a Simpson rule. More... | |
| const DenseVector< _Type > & | vars_as_vector () const |
| For each nodal point we push each variable into a vector in sequence. More... | |
| void | set_vars_from_vector (const DenseVector< _Type > &vec) |
| Set the variables of this mesh from a vector. More... | |
| const std::vector< DenseVector< _Type > > & | get_vars () const |
| void | dump () const |
| A simple method for dumping data to std::cout. More... | |
| void | dump_gnu (std::string filename, int precision=10) const |
| A simple method for dumping data to a file for gnuplot. More... | |
| void | remesh1 (const DenseVector< _Xtype > &z) |
| Interpolate this mesh data (linearly) into a new mesh with nodal points defined in the argument list. More... | |
| void | scale (_Type x) |
| Scale the whole contents of the mesh. More... | |
| void | normalise (const std::size_t &var) |
| Normalise all data in the mesh based on one variable. More... | |
| double | max_abs (unsigned var) |
| Find the maximum stored absolute value in the mesh for a given variable in a range of the domain. More... | |
| void | read (std::string filename, const bool reset=false) |
| Assign mesh contents using a filename. More... | |
| DenseVector< double > | find_roots1 (const std::size_t &var, double value) const |
| void | remesh1 (const DenseVector< double > &newX) |
| void | remesh1 (const DenseVector< double > &newX) |
| void | remesh1 (const DenseVector< std::complex< double > > &z) |
| DenseVector< double > | get_interpolated_vars (const double &x_pos) const |
| DenseVector< std::complex< double > > | get_interpolated_vars (const double &x_pos) const |
| DenseVector< std::complex< double > > | get_interpolated_vars (const std::complex< double > &pos) const |
| DenseVector< double > | find_roots1 (const std::size_t &var, double value) const |
| void | read (std::string filename, bool reset) |
| void | read (std::string filename, bool reset) |
| void | read (std::string filename, bool reset) |
| void | dump_gnu (std::string filename, int precision) const |
| void | dump_gnu (std::string filename, int precision) const |
| void | dump_gnu (std::string filename, int precision) const |
Protected Attributes | |
| std::size_t | m_nv |
| DenseVector< _Xtype > | m_X |
| DenseVector< _Type > | m_vars |
A one dimensional mesh utility object.
Data can be placed into the mesh for interpolation to a new mesh or computation of integrals of the data. The default typing assumes that the mesh is along the real line. You can store (complex) data across a set of points in the complex plane using the second typename.
Definition at line 24 of file OneD_Node_Mesh.h.
|
inline |
Default constructor.
Definition at line 28 of file OneD_Node_Mesh.h.
References CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::m_nv.
|
inline |
ctor for a given nodal distribution
| nodes | The positions of the nodal points |
| nvars | The number of variables to store in the mesh |
Definition at line 36 of file OneD_Node_Mesh.h.
References CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::m_nv, CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::m_vars, and CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::m_X.
|
inline |
implicit conversion ctor for D_complex from double data
Definition at line 259 of file OneD_Node_Mesh.h.
|
inline |
ctor from an existing file
| filename | Filename of the data file |
| nnodes | Number of nodes |
| nvars | Number of variables stored at each node |
Definition at line 64 of file OneD_Node_Mesh.h.
References CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::m_vars, CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::m_X, and CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::read().
|
inlinevirtual |
|
inline |
Access a nodal position.
| node | The nodal position to return |
Definition at line 283 of file OneD_Node_Mesh.h.
|
inline |
Access a nodal position.
| node | The nodal position to return |
Definition at line 278 of file OneD_Node_Mesh.h.
Referenced by CppNoddy::FT::dft(), CppNoddy::FT::dft_with_shift(), CppNoddy::HST::Orr_Sommerfeld::global_evp(), CppNoddy::FT::idft(), CppNoddy::FT::idft_with_ishift(), CppNoddy::FT::ishift(), main(), CppNoddy::Utility::max_abs_location(), CppNoddy::Utility::max_abs_location_range(), and CppNoddy::FT::shift().
| void CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::dump |
A simple method for dumping data to std::cout.
Definition at line 499 of file OneD_Node_Mesh.cpp.
Referenced by main().
| void CppNoddy::OneD_Node_Mesh< double, double >::dump_gnu | ( | std::string | filename, |
| int | precision | ||
| ) | const |
Definition at line 511 of file OneD_Node_Mesh.cpp.
| void CppNoddy::OneD_Node_Mesh< std::complex< double >, double >::dump_gnu | ( | std::string | filename, |
| int | precision | ||
| ) | const |
Definition at line 528 of file OneD_Node_Mesh.cpp.
| void CppNoddy::OneD_Node_Mesh< std::complex< double >, std::complex< double > >::dump_gnu | ( | std::string | filename, |
| int | precision | ||
| ) | const |
| void CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::dump_gnu | ( | std::string | filename, |
| int | precision = 10 |
||
| ) | const |
A simple method for dumping data to a file for gnuplot.
| filename | The filename to write the data to (will overwrite) |
| precision | Precision of the output strings |
Referenced by main().
| DenseVector< double > CppNoddy::OneD_Node_Mesh< double, double >::find_roots1 | ( | const std::size_t & | var, |
| double | value | ||
| ) | const |
Definition at line 65 of file OneD_Node_Mesh.cpp.
References CppNoddy::DenseVector< _Type >::push_back().
| DenseVector< double > CppNoddy::OneD_Node_Mesh< std::complex< double >, double >::find_roots1 | ( | const std::size_t & | var, |
| double | value | ||
| ) | const |
Definition at line 306 of file OneD_Node_Mesh.cpp.
| DenseVector< double > CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::find_roots1 | ( | const std::size_t & | var, |
| double | value = 0.0 |
||
| ) | const |
Find a list of approximate locations at which a specified variable attains a given value.
First order only.
| var | The variable to be examined for zeros |
| value | The value to find |
Referenced by main().
| DenseVector< _Type > CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::get_interpolated_vars | ( | const _Xtype & | pos | ) | const |
Get the variable data at an interpolated position using a first order scheme.
Doesn't really make sense unless the data is along the real line.
| pos | The position to interpolate at. |
Referenced by CppNoddy::TwoD_Mapped_Node_Mesh< _Type >::get_interpolated_vars(), CppNoddy::TwoD_Node_Mesh< _Type >::get_interpolated_vars(), and main().
| DenseVector< double > CppNoddy::OneD_Node_Mesh< double, double >::get_interpolated_vars | ( | const double & | x_pos | ) | const |
Definition at line 209 of file OneD_Node_Mesh.cpp.
| DenseVector< std::complex< double > > CppNoddy::OneD_Node_Mesh< std::complex< double >, double >::get_interpolated_vars | ( | const double & | x_pos | ) | const |
Definition at line 240 of file OneD_Node_Mesh.cpp.
| DenseVector< std::complex< double > > CppNoddy::OneD_Node_Mesh< std::complex< double >, std::complex< double > >::get_interpolated_vars | ( | const std::complex< double > & | pos | ) | const |
Definition at line 269 of file OneD_Node_Mesh.cpp.
| std::size_t CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::get_nnodes |
Definition at line 50 of file OneD_Node_Mesh.cpp.
Referenced by CppNoddy::HST::Rayleigh< _Type >::eigenvector(), CppNoddy::HST::Orr_Sommerfeld::global_evp(), CppNoddy::FT::idft(), CppNoddy::FT::ishift(), main(), CppNoddy::Utility::max_abs_location(), CppNoddy::Utility::max_abs_location_range(), and CppNoddy::FT::shift().
| DenseVector< _Type > CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::get_nodes_vars | ( | const std::size_t & | node | ) | const |
Get the variables stored at A SPECIFIED node.
| node | The nodal index to be returned |
Definition at line 33 of file OneD_Node_Mesh.cpp.
References CppNoddy::DenseVector< _Type >::push_back().
Referenced by CppNoddy::FT::dft_with_shift(), CppNoddy::FT::idft(), and CppNoddy::FT::idft_with_ishift().
| std::size_t CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::get_nvars |
Definition at line 55 of file OneD_Node_Mesh.cpp.
Referenced by CppNoddy::FT::idft(), CppNoddy::FT::ishift(), and CppNoddy::FT::shift().
| const std::vector< DenseVector< _Type > > & CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::get_vars | ( | ) | const |
| _Type CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::integral2 | ( | std::size_t | var = 0 | ) | const |
Integrate over the domain.
Typically useful for finite volume methods.
| var | The variable-index to be integrated over the mesh using a trapezium rule. |
Definition at line 314 of file OneD_Node_Mesh.cpp.
Referenced by main().
| _Type CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::integral4 | ( | std::size_t | var = 0 | ) | const |
Integrate over the domain with a Simpson rule.
| var | The variable-index to be integrated over the mesh using a trapezium rule. |
Definition at line 341 of file OneD_Node_Mesh.cpp.
Referenced by main().
|
inline |
Find the maximum stored absolute value in the mesh for a given variable in a range of the domain.
| var | The variable index whose maximum is being asked for |
| left | Only examine the sub-range x>left |
| right | Only examine the sub-range x<right |
| var | The variable index whose maximum is being asked for |
Definition at line 228 of file OneD_Node_Mesh.h.
References CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::m_nv, CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::m_vars, and CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::m_X.
Referenced by CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::normalise().
| const DenseVector< _Xtype > & CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::nodes |
Definition at line 60 of file OneD_Node_Mesh.cpp.
Referenced by CppNoddy::HST::Rayleigh< _Type >::eigenvector().
|
inline |
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. |
Definition at line 184 of file OneD_Node_Mesh.h.
References CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::m_vars, and CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::max_abs().
Referenced by main().
|
inline |
Access a variable at a node.
| i | The index of the node to be accessed |
| var | The variable to return the data for |
Definition at line 268 of file OneD_Node_Mesh.h.
|
inline |
Access a variable at a node.
| i | The index of the node to be accessed |
| var | The variable to return the data for |
Definition at line 273 of file OneD_Node_Mesh.h.
| void CppNoddy::OneD_Node_Mesh< double, double >::read | ( | std::string | filename, |
| bool | reset | ||
| ) |
Definition at line 377 of file OneD_Node_Mesh.cpp.
| void CppNoddy::OneD_Node_Mesh< D_complex, double >::read | ( | std::string | filename, |
| bool | reset | ||
| ) |
Definition at line 417 of file OneD_Node_Mesh.cpp.
| void CppNoddy::OneD_Node_Mesh< D_complex, D_complex >::read | ( | std::string | filename, |
| bool | reset | ||
| ) |
Definition at line 457 of file OneD_Node_Mesh.cpp.
| void CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::read | ( | std::string | filename, |
| const bool | reset = false |
||
| ) |
Assign mesh contents using a filename.
| filename | Filename that contains the data |
| reset | A boolean, if true then coordinate data is overwritten using the file data. Default is false. |
Referenced by CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::OneD_Node_Mesh().
| void CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::remesh1 | ( | const DenseVector< _Xtype > & | z | ) |
Interpolate this mesh data (linearly) into a new mesh with nodal points defined in the argument list.
| z | The nodal coordinates to be used in the new mesh. |
Referenced by main(), and CppNoddy::HST::Rayleigh< _Type >::remesh1().
| void CppNoddy::OneD_Node_Mesh< double, double >::remesh1 | ( | const DenseVector< double > & | newX | ) |
Definition at line 99 of file OneD_Node_Mesh.cpp.
| void CppNoddy::OneD_Node_Mesh< std::complex< double >, double >::remesh1 | ( | const DenseVector< double > & | newX | ) |
Definition at line 149 of file OneD_Node_Mesh.cpp.
| void CppNoddy::OneD_Node_Mesh< std::complex< double >, std::complex< double > >::remesh1 | ( | const DenseVector< std::complex< double > > & | z | ) |
Definition at line 201 of file OneD_Node_Mesh.cpp.
|
inline |
Scale the whole contents of the mesh.
| x | The value to multiply the contents of the mesh by |
Definition at line 176 of file OneD_Node_Mesh.h.
References CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::m_vars.
| void CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::set_nodes_vars | ( | const std::size_t | node, |
| const DenseVector< _Type > & | u | ||
| ) |
Set the variables stored at A SPECIFIED node.
| node | The nodal index to be set |
| u | The vector of VARIABLES to be written to this nodal point |
Definition at line 17 of file OneD_Node_Mesh.cpp.
References U.
Referenced by CppNoddy::ODE_EVP< _Type >::add_tagged_to_mesh(), CppNoddy::FT::dft(), CppNoddy::TwoD_Mapped_Node_Mesh< _Type >::get_interpolated_vars(), CppNoddy::OneD_TVDLF_Mesh::get_slope(), CppNoddy::OneD_TVDLF_Mesh::get_soln(), CppNoddy::TwoD_Mapped_Node_Mesh< _Type >::get_xsection_at_xnode(), CppNoddy::TwoD_Node_Mesh< _Type >::get_xsection_at_xnode(), CppNoddy::TwoD_Mapped_Node_Mesh< _Type >::get_xsection_at_ynode(), and CppNoddy::TwoD_Node_Mesh< _Type >::get_xsection_at_ynode().
| void CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::set_vars_from_vector | ( | const DenseVector< _Type > & | vec | ) |
Set the variables of this mesh from a vector.
| vec | The vector to be used. |
Definition at line 86 of file OneD_Node_Mesh.cpp.
References CppNoddy::DenseVector< _Type >::size().
Referenced by main().
| _Xtype CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::squared_integral2 | ( | std::size_t | var = 0 | ) | const |
Compute the integral of the absolute variable squared: |variable|^2.
| var | The variable-index to be integrated |
Definition at line 327 of file OneD_Node_Mesh.cpp.
| const DenseVector< _Type > & CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::vars_as_vector |
For each nodal point we push each variable into a vector in sequence.
So the returned vector has the data v_00,,...,v_0n,v_10,...,v1n,....v_mn, where the first index denotes the nodal point 0-m and the second the variable 0-n.
Definition at line 81 of file OneD_Node_Mesh.cpp.
|
protected |
Definition at line 247 of file OneD_Node_Mesh.h.
Referenced by CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::max_abs(), and CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::OneD_Node_Mesh().
|
protected |
|
protected |
Definition at line 249 of file OneD_Node_Mesh.h.
Referenced by CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::max_abs(), and CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::OneD_Node_Mesh().
1.9.5
© 2012
R.E. Hewitt