.TH "src/utils.cpp" 3 "Sun Oct 8 2023" "Penning Trap Simulation" \" -*- nroff -*- .ad l .nh .SH NAME src/utils.cpp \- Implementation of the utils\&. .SH SYNOPSIS .br .PP \fC#include 'utils\&.hpp'\fP .br .SS "Functions" .in +1c .ti -1c .RI "std::string \fBscientific_format\fP (double d, int width, int prec)" .br .RI "Turns a double into a string written in scientific format\&. " .ti -1c .RI "std::string \fBscientific_format\fP (const std::vector< double > &v, int width, int prec)" .br .RI "Turns a vector of doubles into a string written in scientific format\&. " .ti -1c .RI "void \fBm_assert\fP (bool expr, std::string expr_str, std::string f, std::string file, int line, std::string msg)" .br .RI "Test an expression, confirm that test is ok, or abort execution\&. " .ti -1c .RI "bool \fBarma_vector_close_to\fP (arma::vec &a, arma::vec &b, double tol)" .br .RI "Test if two armadillo vectors are close to each other\&. " .in -1c .SH "Detailed Description" .PP Implementation of the utils\&. .PP \fBAuthor\fP .RS 4 Cory Alexander Balaton (coryab) .PP Janita Ovidie Sandtrøen Willumsen (janitaws) .RE .PP \fBVersion\fP .RS 4 1\&.0 .RE .PP .PP \fBBug\fP .RS 4 No known bugs .RE .PP .PP Definition in file \fButils\&.cpp\fP\&. .SH "Function Documentation" .PP .SS "bool arma_vector_close_to (arma::vec & a, arma::vec & b, double tol = \fC1e\-8\fP)" .PP Test if two armadillo vectors are close to each other\&. This function takes in 2 vectors and checks if they are approximately equal to each other given a tolerance\&. .PP \fBParameters\fP .RS 4 \fIa\fP Vector a .br \fIb\fP Vector b .br \fItol\fP The tolerance .RE .PP \fBReturns\fP .RS 4 Boolean .RE .PP .PP Definition at line \fB59\fP of file \fButils\&.cpp\fP\&. .SS "void m_assert (bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)" .PP Test an expression, confirm that test is ok, or abort execution\&. This function takes in an expression and prints an OK message if it's true, or it prints a fail message and aborts execution if it fails\&. .PP \fBParameters\fP .RS 4 \fIexpr\fP The expression to be evaluated .br \fIexpr_str\fP The stringified version of the expression .br \fIfunc\fP The function name of the caller .br \fIfile\fP The file of the caller .br \fIline\fP The line number where this function is called from .br \fImsg\fP The message to be displayed .RE .PP .PP Definition at line \fB40\fP of file \fButils\&.cpp\fP\&. .SS "std::string scientific_format (const std::vector< double > & v, int width = \fC20\fP, int prec = \fC10\fP)" .PP Turns a vector of doubles into a string written in scientific format\&. .PP \fBParameters\fP .RS 4 \fIv\fP The vector to stringify .br \fIwidth\fP The reserved width of the string .br \fIprec\fP The precision of the stringified number .RE .PP \fBReturns\fP .RS 4 String .RE .PP .PP Definition at line \fB21\fP of file \fButils\&.cpp\fP\&. .SS "std::string scientific_format (double d, int width = \fC20\fP, int prec = \fC10\fP)" .PP Turns a double into a string written in scientific format\&. Code stolen from https://github.com/anderkve/FYS3150 Header: https://github.com/anderkve/FYS3150/blob/master/code_examples/compilation_linking/example_1/include/utils.hpp Source: https://github.com/anderkve/FYS3150/blob/master/code_examples/compilation_linking/example_1/src/utils.cpp .PP \fBParameters\fP .RS 4 \fId\fP The number to stringify .br \fIwidth\fP The reserved width of the string .br \fIprec\fP The precision of the stringified number .RE .PP \fBReturns\fP .RS 4 String .RE .PP .PP Definition at line \fB14\fP of file \fButils\&.cpp\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Penning Trap Simulation from the source code\&.