Computational Science Based on HPC
Functions
utils.h File Reference

This file contains utility functions used by oscillations simulation to help in calculations. More...

Go to the source code of this file.

Functions

int _valid_osc (double x, double y, double length, double mass, double gravity, double k, double time_limit, double step_size, double damping_coefficent, int number_of_files, double Fo)
 Validate on input entered to oscillation.
 
int _min_int (int x, int y)
 get the minimum between x,y
 
int _round (double x)
 round x value to the nearest int
 
double _dx (double dx)
 calculate dx for elastic pendulum system
 
double _dy (double dy)
 calculate dy for elastic pendulum system
 
double _f1 (double x, double y, double dx, double tx, double ty, double k, double m, double b, double r)
 calculate first function to solve ode in elastic pendulum
 
double _f2 (double x, double y, double dy, double tx, double ty, double k, double m, double b, double r, double g)
 calculate second function to solve ode in elastic pendulum
 
void printmemsizestream (char *str, unsigned long ramsize)
 
int printmemstream ()
 this function prints memory details for the computer
 
int cpu_inf_stream ()
 this function prints the cpu info for the computer
 
int _mkdir (char *_dir_name)
 

Detailed Description

This file contains utility functions used by oscillations simulation to help in calculations.

Function Documentation

◆ _dx()

double _dx ( double  dx)

calculate dx for elastic pendulum system

Parameters
dx
Returns

◆ _dy()

double _dy ( double  dy)

calculate dy for elastic pendulum system

Parameters
dy
Returns

◆ _f1()

double _f1 ( double  x,
double  y,
double  dx,
double  tx,
double  ty,
double  k,
double  m,
double  b,
double  r 
)

calculate first function to solve ode in elastic pendulum

Parameters
x
y
dx
tx
ty
k
m
b
r
Returns

◆ _f2()

double _f2 ( double  x,
double  y,
double  dy,
double  tx,
double  ty,
double  k,
double  m,
double  b,
double  r,
double  g 
)

calculate second function to solve ode in elastic pendulum

Parameters
x
y
dy
tx
ty
k
m
b
r
g
Returns

◆ _min_int()

int _min_int ( int  x,
int  y 
)

get the minimum between x,y

Parameters
x
y
Returns
min(x,y)

◆ _round()

int _round ( double  x)

round x value to the nearest int

Parameters
x
Returns
rounded x

◆ _valid_osc()

int _valid_osc ( double  x,
double  y,
double  length,
double  mass,
double  gravity,
double  k,
double  time_limit,
double  step_size,
double  damping_coefficent,
int  number_of_files,
double  Fo 
)

Validate on input entered to oscillation.

Parameters
xdistance x
ydistance y
lengthmax length
massmass of bob
gravity
kstiffeness of spring
time_limithow much time needed to simulate
step_sizehow much time change per iteration
damping_coefficentdamping factor affecting on the system
number_of_files
Fo
Returns
1 if all are valid, 0 if [mass < 0 || k < 0 || time_limit <= 0 || step_size < 0 || length <= 0 || gravity <= 0 || damping_coefficent < 0], and -1 if max_length > length

◆ cpu_inf_stream()

int cpu_inf_stream ( )

this function prints the cpu info for the computer

Returns
int

◆ printmemstream()

int printmemstream ( )

this function prints memory details for the computer

Returns
int