CppNoddy
0.92
|
Some utility methods associated with CppNoddy containers. More...
Functions | |
DenseVector< double > | uniform_node_vector (const double &lower, const double &upper, const std::size_t &N) |
Return a DENSE vector with the nodal points of a uniform mesh distributed between the upper/lower bounds as specified. More... | |
DenseVector< double > | power_node_vector (const double &lower, const double &upper, const std::size_t &N, const double &power) |
Return a DENSE vector with the nodal points of a non-uniform mesh distributed between the upper/lower bounds as specified with more nodes clustered near lower or upper depending upon the differencee of the power from unity. More... | |
DenseVector< double > | two_uniform_node_vector (const double &lower, const double &mid, const double &upper, const std::size_t &N1, const std::size_t &N2) |
Return a dense vector with two uniform distributions in two separate regions. More... | |
DenseVector< double > | three_uniform_node_vector (const double &lower, const double &mid1, const double &mid2, const double &upper, const std::size_t &N1, const std::size_t &N2, const std::size_t &N3) |
Return a dense vector with two uniform distributions in two separate regions. More... | |
DenseVector< double > | mid_weighted_node_vector (const double &lower, const double &upper, const std::size_t &N, const double &power) |
Return a dense vector of nodal positions with more nodes concentrated at the mid point of the range. More... | |
template<typename _Type > | |
void | vels_from_streamfn_Cartesian (const TwoD_Node_Mesh< _Type > &source, TwoD_Node_Mesh< _Type > &uv) |
template<typename _Type > | |
void | vels_from_streamfn_Cartesian (const TwoD_Mapped_Node_Mesh< _Type > &source, TwoD_Mapped_Node_Mesh< _Type > &uv) |
DenseMatrix< double > | multiply (DenseMatrix< double > &A, DenseMatrix< double > &B) |
BLAS wrapper to do DOUBLE DENSE A_{MxK} * B_{KxN} = C_{MxN} Since this is a Fortran library, it assumes a column_major format, but CppNoddy uses row_major. More... | |
template<typename _Type > | |
_Type | dot (const DenseVector< _Type > &X, const DenseVector< _Type > &Y) |
Templated dot product. More... | |
template<typename _Type > | |
int | sgn (const _Type &a) |
DenseVector< double > | real (const DenseVector< D_complex > &X) |
Return a double DENSE vector containing the real part of a complex DENSE vector. More... | |
DenseVector< double > | imag (const DenseVector< D_complex > &X) |
Return a double DENSE vector containing the imaginary part of a complex DENSE vector. More... | |
std::string | stringify (const int &val) |
Return an integer value as a string - useful for file naming. More... | |
std::string | stringify (const double &val, int p) |
Return a double value as a string - useful for file naming. More... | |
double | max_abs_location (OneD_Node_Mesh< double > &mesh, unsigned var) |
double | max_abs_location_range (OneD_Node_Mesh< double > &mesh, unsigned var, double left, double right) |
Some utility methods associated with CppNoddy containers.
_Type CppNoddy::Utility::dot | ( | const DenseVector< _Type > & | X, |
const DenseVector< _Type > & | Y | ||
) |
Templated dot product.
X | First dense vector |
Y | Second dense vector |
Definition at line 314 of file Utility.h.
References CppNoddy::DenseVector< _Type >::begin(), CppNoddy::DenseVector< _Type >::end(), and CppNoddy::DenseVector< _Type >::size().
Referenced by CppNoddy::ODE_BVP< _Type, _Xtype >::arclength_solve(), CppNoddy::Newton< _Type >::arclength_solve(), CppNoddy::PDE_IBVP< _Type >::assemble_matrix_problem(), CppNoddy::Equation_1matrix< _Type, double >::get_jacobian_of_matrix0_mult_vector(), and main().
DenseVector< double > CppNoddy::Utility::imag | ( | const DenseVector< D_complex > & | X | ) |
Return a double DENSE vector containing the imaginary part of a complex DENSE vector.
X | The complex vector to take the imaginary part of |
Definition at line 185 of file Utility.cpp.
References CppNoddy::DenseVector< _Type >::size().
double CppNoddy::Utility::max_abs_location | ( | OneD_Node_Mesh< double > & | mesh, |
unsigned | var | ||
) |
Definition at line 54 of file Utility.cpp.
References CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::coord(), and CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::get_nnodes().
double CppNoddy::Utility::max_abs_location_range | ( | OneD_Node_Mesh< double > & | mesh, |
unsigned | var, | ||
double | left, | ||
double | right | ||
) |
Definition at line 82 of file Utility.cpp.
References CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::coord(), and CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::get_nnodes().
DenseVector< double > CppNoddy::Utility::mid_weighted_node_vector | ( | const double & | lower, |
const double & | upper, | ||
const std::size_t & | N, | ||
const double & | power | ||
) |
Return a dense vector of nodal positions with more nodes concentrated at the mid point of the range.
lower | The first nodal position. |
upper | The final nodal position. |
N | The number of nodes required. |
power | A measure of the non-uniformity, power = 1 => uniform distribution |
Definition at line 155 of file Utility.cpp.
DenseMatrix< double > CppNoddy::Utility::multiply | ( | DenseMatrix< double > & | A, |
DenseMatrix< double > & | B | ||
) |
BLAS wrapper to do DOUBLE DENSE A_{MxK} * B_{KxN} = C_{MxN} Since this is a Fortran library, it assumes a column_major format, but CppNoddy uses row_major.
To be consistent we'll simply do (B^T)_{NxK} * (A^T)_{KxM} = (C^T)_{NxM} instead. Note that inversion of the transpose of the result C^T is handled implicitly via the construction of C.
A | First dense double matrix to be multiplied |
B | Second dense double matrix to be multiplied |
Definition at line 225 of file Utility.cpp.
References CppNoddy::FortranData::base(), BLAS_DGEMM, CppNoddy::DenseMatrix< _Type >::ncols(), CppNoddy::DenseMatrix< _Type >::nrows(), and CppNoddy::FortranData::to_dense_matrix().
Referenced by main().
DenseVector< double > CppNoddy::Utility::power_node_vector | ( | const double & | lower, |
const double & | upper, | ||
const std::size_t & | N, | ||
const double & | power | ||
) |
Return a DENSE vector with the nodal points of a non-uniform mesh distributed between the upper/lower bounds as specified with more nodes clustered near lower or upper depending upon the differencee of the power from unity.
When power=1 this should provide a uniform mesh.
lower | The lower bound of the uniform nodal distribution |
upper | The upper bound of the uniform nodal distribution |
N | The number of nodal points |
power | A measure of the non-uniformity |
Definition at line 123 of file Utility.cpp.
References V.
Referenced by main().
DenseVector< double > CppNoddy::Utility::real | ( | const DenseVector< D_complex > & | X | ) |
Return a double DENSE vector containing the real part of a complex DENSE vector.
X | The complex vector to take the real part of |
Definition at line 177 of file Utility.cpp.
References CppNoddy::DenseVector< _Type >::size().
int CppNoddy::Utility::sgn | ( | const _Type & | a | ) |
std::string CppNoddy::Utility::stringify | ( | const double & | val, |
int | p | ||
) |
Return a double value as a string - useful for file naming.
val | The double value to be stringified |
p | Precision to be used in the output |
Definition at line 199 of file Utility.cpp.
References p.
std::string CppNoddy::Utility::stringify | ( | const int & | val | ) |
Return an integer value as a string - useful for file naming.
val | The integer value to be stringified. |
Definition at line 193 of file Utility.cpp.
Referenced by CppNoddy::TrackerFile::header(), main(), and CppNoddy::TwoD_Node_Mesh< _Type >::remesh1().
DenseVector< double > CppNoddy::Utility::three_uniform_node_vector | ( | const double & | lower, |
const double & | mid1, | ||
const double & | mid2, | ||
const double & | upper, | ||
const std::size_t & | N1, | ||
const std::size_t & | N2, | ||
const std::size_t & | N3 | ||
) |
Return a dense vector with two uniform distributions in two separate regions.
lower | The first node |
mid1 | The node that defines the first interior boundary |
mid2 | The node that defines the second interior boundary |
upper | The final node |
N1 | The number of nodes in the first region |
N2 | The number of nodes in the second region |
N3 | The number of nodes in the third region |
Definition at line 141 of file Utility.cpp.
References CppNoddy::DenseVector< _Type >::push_back(), and uniform_node_vector().
DenseVector< double > CppNoddy::Utility::two_uniform_node_vector | ( | const double & | lower, |
const double & | mid, | ||
const double & | upper, | ||
const std::size_t & | N1, | ||
const std::size_t & | N2 | ||
) |
Return a dense vector with two uniform distributions in two separate regions.
lower | The first node |
mid | The node that defines the boundary between the uniform meshes |
upper | The final node |
N1 | The number of nodes in the first region |
N2 | The number of nodes in the second region |
Definition at line 131 of file Utility.cpp.
References CppNoddy::DenseVector< _Type >::push_back(), and uniform_node_vector().
DenseVector< double > CppNoddy::Utility::uniform_node_vector | ( | const double & | lower, |
const double & | upper, | ||
const std::size_t & | N | ||
) |
Return a DENSE vector with the nodal points of a uniform mesh distributed between the upper/lower bounds as specified.
lower | The lower bound of the uniform nodal distribution |
upper | The upper bound of the uniform nodal distribution |
N | The number of nodal points |
Definition at line 113 of file Utility.cpp.
References V.
Referenced by CppNoddy::FnQuadrature::FnQuadrature(), CppNoddy::TwoD_Mapped_Node_Mesh< _Type >::init_mapping(), main(), CppNoddy::Example::Neutral_residual::Neutral_residual(), CppNoddy::FnQuadrature::set_subintervals(), three_uniform_node_vector(), and two_uniform_node_vector().
void CppNoddy::Utility::vels_from_streamfn_Cartesian | ( | const TwoD_Mapped_Node_Mesh< _Type > & | source, |
TwoD_Mapped_Node_Mesh< _Type > & | uv | ||
) |
Definition at line 166 of file Utility.h.
void CppNoddy::Utility::vels_from_streamfn_Cartesian | ( | const TwoD_Node_Mesh< _Type > & | source, |
TwoD_Node_Mesh< _Type > & | uv | ||
) |
Definition at line 83 of file Utility.h.
© 2012
R.E. Hewitt