libMesh
|
Classes | |
struct | CompareUnderlying |
Struct which defines a custom comparison object that can be used with std::sets of std::unique_ptrs. More... | |
struct | do_pow |
An efficient template instantiation for raising to an arbitrary integer power. More... | |
struct | do_pow< 0, T > |
struct | do_pow< 1, T > |
struct | do_pow< 6, T > |
class | is_streamable |
Helper struct for enabling template metaprogramming/SFINAE. More... | |
class | ReverseBytes |
This Functor simply takes an object and reverses its byte representation. More... | |
Functions | |
template<typename T > | |
std::string | enum_to_string (const T e) |
uint32_t | hashword (const uint32_t *k, size_t length, uint32_t initval=0) |
The hashword function takes an array of uint32_t's of length 'length' and computes a single key from it. More... | |
uint32_t | hashword (const std::vector< uint32_t > &keys, uint32_t initval=0) |
Calls function above with slightly more convenient std::vector interface. More... | |
uint32_t | hashword2 (const uint32_t &first, const uint32_t &second, uint32_t initval=0) |
This is a hard-coded version of hashword for hashing exactly 2 numbers. More... | |
uint64_t | hashword2 (const uint64_t first, const uint64_t second) |
Computes the same hash as calling fnv_64_buf() with exactly two entries. More... | |
uint16_t | hashword2 (const uint16_t first, const uint16_t second) |
uint64_t | hashword (const uint64_t *k, size_t length) |
Call the 64-bit FNV hash function. More... | |
uint16_t | hashword (const uint16_t *k, size_t length) |
In a personal communication from Bob Jenkins, he recommended using "Probably final_mix() from lookup3.c... More... | |
template<typename Container > | |
Container::value_type | hashword (const Container &keys) |
Calls functions above with slightly more convenient std::vector/array compatible interface. More... | |
template<typename T > | |
T | string_to_enum (const std::string &s) |
template<typename T > | |
T | string_to_enum (std::string_view s) |
template<typename T > | |
T | string_to_enum (const char *s) |
std::string | get_timestamp () |
void | print_timestamp (std::ostream &target=std::cout) |
std::string | system_info () |
template<typename Map , typename Key , typename std::enable_if<!is_streamable< Key >::value, Key >::type * = nullptr> | |
Map::mapped_type & | map_find (Map &map, const Key &key, const char *filename, int line_number) |
-Wdangling-reference was nowhere near ready to add to -Wall in gcc 13. More... | |
template<typename Map , typename Key , typename std::enable_if<!is_streamable< Key >::value, Key >::type * = nullptr> | |
const Map::mapped_type & | map_find (const Map &map, const Key &key, const char *filename, int line_number) |
A version of the function above that works for const objects. More... | |
template<typename Vector > | |
Vector::reference & | vector_at (Vector &vec, typename Vector::size_type i, const char *filename, int line_number) |
A replacement for std::vector::at(i) which is meant to be used with a macro, and, unlike at(), gives a proper line number and useful error message when the index is past the end. More... | |
template<typename Vector > | |
Vector::const_reference & | vector_at (const Vector &vec, typename Vector::size_type i, const char *filename, int line_number) |
Same as above, but for const inputs. More... | |
template<typename ForwardIter , typename T > | |
void | iota (ForwardIter first, ForwardIter last, T value) |
Utility::iota was created back when std::iota was just an SGI STL extension. More... | |
template<class InputIterator > | |
bool | is_sorted (InputIterator first, InputIterator last) |
Utility::is_sorted was created back when std::is_sorted was just an SGI STL extension. More... | |
template<class ForwardIterator , class T > | |
ForwardIterator | binary_find (ForwardIterator first, ForwardIterator last, const T &value) |
The STL provides std::binary_search() which returns true or false depending on whether the searched-for value is found. More... | |
template<class ForwardIterator , class T , class Compare > | |
ForwardIterator | binary_find (ForwardIterator first, ForwardIterator last, const T &value, Compare comp) |
As above, but takes a custom comparison object. More... | |
template<int N, typename T > | |
T | pow (const T &x) |
unsigned int | factorial (unsigned int n) |
A simple implementation of the factorial. More... | |
template<typename T > | |
T | binomial (T n, T k) |
template<typename T > | |
void | deallocate (std::vector< T > &vec) |
A convenient method to truly empty a vector using the "swap trick". More... | |
std::string_view | basename_of (const std::string &fullname) |
bool | contains (std::string_view superstring, std::string_view substring) |
Look for a substring within a string. More... | |
bool | ends_with (std::string_view superstring, std::string_view suffix) |
Look for a substring at the very end of a string. More... | |
std::string | complex_filename (std::string basename, unsigned int r_o_c=0) |
void | prepare_complex_data (const std::vector< Complex > &source, std::vector< Real > &real_part, std::vector< Real > &imag_part) |
Prepare complex data for writing. More... | |
int | mkdir (const char *pathname) |
Create a directory. More... | |
std::string | unzip_file (std::string_view name) |
Create an unzipped copy of a bz2 or xz file, returning the name of the now-unzipped file that can be directly opened. More... | |
std::string_view libMesh::Utility::basename_of | ( | const std::string & | fullname | ) |
Definition at line 108 of file utility.C.
Referenced by libMesh::NameBasedIO::read(), libMesh::SparseMatrix< ValOut >::read(), libMesh::NameBasedIO::write(), and libMesh::NameBasedIO::write_equation_systems().
ForwardIterator libMesh::Utility::binary_find | ( | ForwardIterator | first, |
ForwardIterator | last, | ||
const T & | value | ||
) |
The STL provides std::binary_search()
which returns true
or false
depending on whether the searched-for value is found.
In contrast, Utility::binary_find() uses a std::lower_bound() based search on a sorted range to find the required value.
Definition at line 265 of file utility.h.
References value.
Referenced by libMesh::UnstructuredMesh::stitching_helper(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), and NonManifoldGhostingFunctorTest::verify_send_list_entries_helper().
ForwardIterator libMesh::Utility::binary_find | ( | ForwardIterator | first, |
ForwardIterator | last, | ||
const T & | value, | ||
Compare | comp | ||
) |
T libMesh::Utility::binomial | ( | T | n, |
T | k | ||
) |
Definition at line 354 of file utility.h.
Referenced by libMesh::FE< Dim, LAGRANGE_VEC >::shape_deriv(), and libMesh::FE< Dim, LAGRANGE_VEC >::shape_second_deriv().
std::string libMesh::Utility::complex_filename | ( | std::string | basename, |
unsigned int | r_o_c = 0 |
||
) |
r_o_c
= 0 the filename for output of the real part of complex data, and for r_o_c
= 1 the filename for the imaginary part. bool libMesh::Utility::contains | ( | std::string_view | superstring, |
std::string_view | substring | ||
) |
Look for a substring within a string.
Definition at line 205 of file utility.C.
Referenced by libMesh::NameBasedIO::is_parallel_file_format(), main(), libMesh::ErrorVector::plot_error(), libMesh::NameBasedIO::read(), libMesh::TetGenIO::read(), libMesh::UCDIO::read(), libMesh::UNVIO::read(), libMesh::EquationSystems::read(), libMesh::PltLoader::read_data(), libMesh::PltLoader::read_header(), libMesh::System::read_header(), libMesh::NameBasedIO::write(), libMesh::TetGenIO::write(), libMesh::UCDIO::write(), libMesh::UNVIO::write(), libMesh::NameBasedIO::write_equation_systems(), and libMesh::NameBasedIO::write_nodal_data().
void libMesh::Utility::deallocate | ( | std::vector< T > & | vec | ) |
A convenient method to truly empty a vector using the "swap trick".
Definition at line 377 of file utility.h.
Referenced by libMesh::Nemesis_IO::read().
bool libMesh::Utility::ends_with | ( | std::string_view | superstring, |
std::string_view | suffix | ||
) |
Look for a substring at the very end of a string.
Definition at line 213 of file utility.C.
Referenced by libMesh::NameBasedIO::is_parallel_file_format(), libMesh::Xdr::open(), libMesh::STLIO::open_file(), libMesh::AbaqusIO::read(), libMesh::NameBasedIO::read(), libMesh::DynaIO::read(), libMesh::UnstructuredMesh::read(), libMesh::SparseMatrix< ValOut >::read(), libMesh::SparseMatrix< ValOut >::read_matlab(), libMesh::NumericVector< Number >::read_matlab(), unzip_file(), libMesh::NameBasedIO::write(), libMesh::VTKIO::write_nodal_data(), and libMesh::NameBasedIO::write_nodal_data().
std::string libMesh::Utility::enum_to_string | ( | const T | e | ) |
string
which matches the enumeration e
of type T
. Referenced by libMesh::LaspackLinearSolver< T >::adjoint_solve(), libMesh::AbaqusIO::assign_sideset_ids(), libMesh::AbaqusIO::assign_subdomain_ids(), libMesh::FETransformationBase< OutputShape >::build(), libMesh::Partitioner::build(), libMesh::FEAbstract::build(), libMesh::FEGenericBase< FEOutputType< T >::type >::build(), libMesh::Elem::build(), libMesh::MeshTools::Generation::build_cube(), libMesh::FEGenericBase< FEOutputType< T >::type >::build_InfFE(), libMesh::System::calculate_norm(), libMesh::Elem::complete_order_equivalent_type(), libMesh::InfFE< Dim, T_radial, T_map >::compute_node_indices(), libMesh::InfFE< Dim, T_radial, T_map >::compute_node_indices_fast(), libMesh::InfFE< Dim, T_radial, T_map >::compute_shape_indices(), VolumeTest::construct_elem(), libMesh::TriangleWrapper::copy_tri_to_mesh(), libMesh::System::discrete_var_norm(), libMesh::UNVIO::elements_out(), libMesh::ReferenceElem::get(), libMesh::FEInterface::get_continuity(), libMesh::InfFEBase::get_elem_type(), libMesh::Elem::get_info(), libMesh::MeshBase::get_info(), libMesh::FEAbstract::get_refspace_nodes(), libMesh::MeshTools::Generation::Private::idx(), libMesh::FEInterface::ifem_inverse_map(), libMesh::FEInterface::ifem_map(), libMesh::FEInterface::ifem_nodal_soln(), libMesh::PetscVector< libMesh::Number >::init(), libMesh::QNodal::init_1D(), libMesh::QGaussLobatto::init_2D(), libMesh::QClough::init_2D(), libMesh::QSimpson::init_2D(), libMesh::QTrap::init_2D(), libMesh::QGauss::init_2D(), libMesh::QGrid::init_2D(), libMesh::QConical::init_2D(), libMesh::QNodal::init_2D(), libMesh::QGrundmann_Moller::init_2D(), libMesh::QGaussLobatto::init_3D(), libMesh::QClough::init_3D(), libMesh::QTrap::init_3D(), libMesh::QSimpson::init_3D(), libMesh::QGauss::init_3D(), libMesh::QGrid::init_3D(), libMesh::QConical::init_3D(), libMesh::QNodal::init_3D(), libMesh::QGrundmann_Moller::init_3D(), libMesh::AdvectionSystem::init_data(), libMesh::FEInterface::is_hierarchic(), libMesh::LIBMESH_DEFAULT_VECTORIZED_FE(), libMesh::monomial_n_dofs(), libMesh::FEAbstract::on_reference_element(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::VariationalSmootherSystem::prepare_for_smoothing(), libMesh::LinearSolver< Number >::print_converged_reason(), libMesh::Elem::quality(), libMesh::ExodusII_IO::read(), libMesh::AbaqusIO::read_elements(), libMesh::GmshIO::read_mesh(), libMesh::DofMap::reinit(), libMesh::Elem::second_order_equivalent_type(), libMesh::PetscPreconditioner< T >::set_petsc_preconditioner_type(), libMesh::PetscLinearSolver< Number >::set_petsc_solver_type(), libMesh::SlepcEigenSolver< libMesh::Number >::set_slepc_solver_type(), libMesh::AztecLinearSolver< T >::set_solver_type(), libMesh::FE< Dim, LAGRANGE_VEC >::shape(), libMesh::FE< Dim, LAGRANGE_VEC >::shape_deriv(), libMesh::FE< Dim, LAGRANGE_VEC >::shape_second_deriv(), libMesh::EigenSparseLinearSolver< T >::solve(), libMesh::LaspackLinearSolver< T >::solve(), ExodusTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_write(), QuadratureTest::testBuild(), MeshSmootherTest::testVariationalSmoother(), libMesh::TriangleInterface::triangulate(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO_Helper::write_elements(), and libMesh::GmshIO::write_post().
std::string libMesh::Utility::get_timestamp | ( | ) |
Definition at line 37 of file timestamp.C.
References libMesh::out.
Referenced by libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::PerfLog::get_info_header(), print_timestamp(), system_info(), libMesh::TransientRBConstruction::update_residual_terms(), and libMesh::RBConstruction::update_residual_terms().
|
inline |
The hashword function takes an array of uint32_t's of length 'length' and computes a single key from it.
Definition at line 158 of file hashword.h.
Referenced by libMesh::Elem::compute_key(), libMesh::SparsityPattern::Build::handle_vi_vj(), hashword(), libMesh::Polygon::key(), libMesh::Polyhedron::key(), libMesh::Elem::key(), libMesh::Polyhedron::low_order_key(), and libMesh::MeshTools::SidesToElemMap::HashFunction::operator()().
|
inline |
Calls function above with slightly more convenient std::vector interface.
Definition at line 200 of file hashword.h.
References hashword().
|
inline |
Call the 64-bit FNV hash function.
Definition at line 275 of file hashword.h.
|
inline |
In a personal communication from Bob Jenkins, he recommended using "Probably final_mix() from lookup3.c...
You could hash up to 6 16-bit integers that way. The output is c, or the top or bottom 16 bits of c if you only need 16 bit hash values." [JWP]
Definition at line 289 of file hashword.h.
|
inline |
Calls functions above with slightly more convenient std::vector/array compatible interface.
Definition at line 330 of file hashword.h.
References hashword().
|
inline |
This is a hard-coded version of hashword for hashing exactly 2 numbers.
Definition at line 215 of file hashword.h.
Referenced by libMesh::Elem::compute_key(), and libMesh::SparsityPattern::Build::handle_vi_vj().
|
inline |
Computes the same hash as calling fnv_64_buf() with exactly two entries.
This function allows the compiler to optimize by unrolling loops whose number of iterations are known at compile time. By inspecting the assembly generated for different optimization levels, we observed that the compiler sometimes chooses to unroll only the outer loop, but may also choose to unroll both the outer and inner loops.
Definition at line 238 of file hashword.h.
|
inline |
Definition at line 266 of file hashword.h.
void libMesh::Utility::iota | ( | ForwardIter | first, |
ForwardIter | last, | ||
T | value | ||
) |
Utility::iota was created back when std::iota was just an SGI STL extension.
Definition at line 229 of file utility.h.
References value.
Referenced by libMesh::PetscVector< libMesh::Number >::create_subvector(), libMesh::DTKAdapter::DTKAdapter(), libMesh::DynaIO::ElementDefinition::ElementDefinition(), libMesh::OldSolutionCoefs< Output, point_output >::eval_mixed_derivatives(), libMesh::OldSolutionValue< Output, point_output >::eval_mixed_derivatives(), libMesh::EquationSystems::find_variable_numbers(), libMesh::PetscVector< libMesh::Number >::localize(), libMesh::PointLocatorNanoflann::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectInteriors::operator()(), libMesh::System::project_vector(), libMesh::System::projection_matrix(), libMesh::NumericVector< Number >::read_matlab(), libMesh::C0Polygon::retriangulate(), libMesh::RBEIMConstruction::set_rb_construction_parameters(), SparseMatrixTest< LaspackMatrix< Number > >::setValues(), LibMeshNetgenTest::testAllPermutations(), LibMeshNetgenTest::testBadHole(), LibMeshPoly2TriTest::testLibMeshPoly2Tri(), LibMeshPoly2TriTest::testLibMeshPoly2TriHole(), LibMeshPoly2TriTest::testLibMeshPoly2TriSlivers(), and DiagonalMatrixTest::testNumerics().
bool libMesh::Utility::is_sorted | ( | InputIterator | first, |
InputIterator | last | ||
) |
Utility::is_sorted was created back when std::is_sorted was just an SGI STL extension.
Definition at line 247 of file utility.h.
|
inline |
-Wdangling-reference was nowhere near ready to add to -Wall in gcc 13.
A version of the map_find() utility which can only be used if the map key is printable via std::stream.
It's been moved to -Wextra, but we use that too. :-)
See e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109642
Our map_find functions trigger it. This function should not be called directly (although it can be), instead see the libmesh_map_find() macro.
Calls find(key), and checks the result against end(). Returns the corresponding value if found, throws an error otherwise. Templated on the type of map, so this will work with both std::map and std::unordered_map.
|
inline |
A version of the function above that works for const objects.
int libMesh::Utility::mkdir | ( | const char * | pathname | ) |
Create a directory.
Definition at line 152 of file utility.C.
Referenced by libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), libMesh::RBEvaluation::write_out_vectors(), and libMesh::RBConstruction::write_riesz_representors_to_files().
|
inline |
Definition at line 328 of file utility.h.
References libMesh::Utility::do_pow< N, T >::apply().
Referenced by GETPOT_NAMESPACE::GetPot::_DBE_expand(), assemble_ellipticdg(), assemble_laplace(), compute_jacobian(), compute_residual(), compute_stresses(), LinearElasticityWithContact::compute_stresses(), libMesh::ContinuationSystem::continuation_solve(), libMesh::VariationalSmootherSystem::element_time_derivative(), exact_derivative(), exact_solution(), libMesh::RBConstructionBase< CondensedEigenSystem >::generate_training_parameters_deterministic(), libMesh::RBConstructionBase< CondensedEigenSystem >::generate_training_parameters_random(), libMesh::FESubdivision::init_shape_functions(), initial_condition(), libMesh::RBEIMConstruction::inner_product(), libMesh::InverseDistanceInterpolation< KDDim >::interpolate(), libMesh::LIBMESH_DEFAULT_VECTORIZED_FE(), std::LIBMESH_FLOAT128_BINARY(), main(), libMesh::RBEIMConstruction::node_inner_product(), libMesh::Hex::quality(), libMesh::TransientRBEvaluation::rb_solve(), libMesh::FESubdivision::regular_shape(), libMesh::FE< Dim, LAGRANGE_VEC >::shape_deriv(), libMesh::FE< Dim, LAGRANGE_VEC >::shape_second_deriv(), libMesh::RBEIMConstruction::side_inner_product(), libMesh::MeshTools::Modification::smooth(), libMesh::TwostepTimeSolver::solve(), ElemTest< elem_type >::test_n_refinements(), QuadratureTest::testJacobi(), QuadratureTest::testPolynomial(), libMesh::BoundaryInfo::transfer_boundary_ids_from_children(), and libMesh::NetGenMeshInterface::triangulate().
void libMesh::Utility::prepare_complex_data | ( | const std::vector< Complex > & | source, |
std::vector< Real > & | real_part, | ||
std::vector< Real > & | imag_part | ||
) |
Prepare complex data for writing.
|
inline |
T libMesh::Utility::string_to_enum | ( | const std::string & | s | ) |
T
which matches the string s
. T libMesh::Utility::string_to_enum | ( | std::string_view | s | ) |
T
which matches the string_view s
. T libMesh::Utility::string_to_enum | ( | const char * | s | ) |
T
which matches the C-style string s
. std::string libMesh::Utility::system_info | ( | ) |
Definition at line 63 of file utility.C.
References get_timestamp().
std::string libMesh::Utility::unzip_file | ( | std::string_view | name | ) |
Create an unzipped copy of a bz2 or xz file, returning the name of the now-unzipped file that can be directly opened.
This is a hack because we don't have a neat bz2/xz equivalent to gzstreams.
Definition at line 164 of file utility.C.
References ends_with(), and libMesh::Quality::name().
Referenced by libMesh::Xdr::open(), libMesh::STLIO::open_file(), libMesh::AbaqusIO::read(), libMesh::DynaIO::read(), libMesh::SparseMatrix< ValOut >::read_matlab(), and libMesh::NumericVector< Number >::read_matlab().
|
inline |
A replacement for std::vector::at(i) which is meant to be used with a macro, and, unlike at(), gives a proper line number and useful error message when the index is past the end.
|
inline |