Ising_OPV  v4.0.2
Generates and analyzes model bulk heterojunction morphologies in a parallel computing environment
Ising_OPV Namespace Reference

Classes

struct  Coords
 This namespace provides useful constants and utility functions. More...
 
class  Lattice
 This class contains the properties of a three-dimensional lattice and the functions needed to interact with it. More...
 
class  Morphology
 This class contains a lattice representation of a materials blend with the ability to simulate phase separation and perform a variety of structural analyses. More...
 
class  Parameters
 This class contains the parameters used by Ising_OPV and functions to import parameter files. More...
 
class  Version
 This class contains the current version information and version comparison operators. More...
 

Functions

std::vector< std::pair< double, double > > calculateCumulativeHist (const std::vector< std::pair< double, double >> &data)
 Calculates the cumulative histogram from the input probability histogram data. More...
 
std::vector< std::pair< double, int > > calculateHist (const std::vector< int > &data, int bin_size)
 Calculates the histogram for the input integer data vector using the input bin size. More...
 
std::vector< std::pair< double, double > > calculateProbabilityHist (const std::vector< std::pair< double, int >> hist)
 Calculates the probability histogram for the input histogram data vector. The function outputs bin-centered x values and probability y values in a x-y pair vector. More...
 
std::vector< std::pair< double, double > > calculateProbabilityHist (const std::vector< int > &data, int bin_size)
 Calculates the probability histogram for the input integer data vector using the input bin size. More...
 
std::vector< std::pair< double, double > > calculateProbabilityHist (const std::vector< double > &data, int num_bins)
 Calculates the probability histogram for the input double data vector using the input number of bins. More...
 
std::vector< std::pair< double, double > > calculateProbabilityHist (const std::vector< double > &data, double bin_size)
 Calculates the probability histogram for the input data vector using the input bin size. More...
 
std::vector< std::pair< double, double > > calculateProbabilityHist (const std::vector< double > &data, const double bin_size, const int num_bins)
 Calculates the probability histogram for the input data vector using the input bin size and input number of bins. More...
 
std::vector< std::pair< double, double > > calculateProbabilityHist (const std::vector< double > &data, const double bin_start, const double bin_size)
 Calculates the probability histogram for the input data vector using the input bin start value and bin size. More...
 
double integrateData (const std::vector< std::pair< double, double >> &data)
 Numerically integrates a vector of x-y data using the trapezoid rule. More...
 
double interpolateData (const std::vector< std::pair< double, double >> &data, const double x_val)
 Linearly interpolates an x-y data set to determine the interpolated y-value corresponding to an input x-value. More...
 
std::vector< std::pair< double, double > > MPI_calculateProbHistAvg (const std::vector< std::pair< double, int >> &input_hist)
 Uses MPI to calculate the average probability histogram from separate histograms coming from different processors. More...
 
std::vector< double > MPI_calculateVectorAvg (const std::vector< double > &input_vector)
 Uses MPI to calculate the element-wise average vector from separate vectors coming from different processors. More...
 
std::vector< double > MPI_calculateVectorSum (const std::vector< double > &input_vector)
 Uses MPI to calculate the element-wise sum vector from separate equally sized vectors coming from different processors. More...
 
std::vector< int > MPI_calculateVectorSum (const std::vector< int > &input_vector)
 Uses MPI to calculate the element-wise sum vector from separate vectors coming from different processors. More...
 
std::vector< int > MPI_gatherValues (const int input_val)
 Uses MPI to gather integer values from separate processors to build one vector containing all of the data. More...
 
std::vector< double > MPI_gatherValues (const double input_val)
 Uses MPI to gather double values from separate processors to build one vector containing all of the data. More...
 
std::vector< double > MPI_gatherVectors (const std::vector< double > &input_vector)
 Uses MPI to gather vectors from separate processors to build one big vector containing all of the data. More...
 
std::vector< int > MPI_gatherVectors (const std::vector< int > &input_vector)
 Uses MPI to gather vectors from separate processors to build one big vector containing all of the data. More...
 
std::string removeWhitespace (const std::string &str)
 Removes all spaces and ta characters in a string. More...
 
int round_int (const double num)
 Rounds the input double value to the nearest integer value. More...
 
bool str2bool (const std::string &input)
 Extracts a boolean value from a string containing "true" or "false". Throws an invalid_argument exception if the input string is not "true" or "false". More...
 
template<typename T >
double array_avg (const T data[], const int array_size)
 This template function calculates and returns the average value in double format when given an array of numerical datatypes. More...
 
template<typename T >
array_median (const T data[], const int array_size)
 This template function calculates and returns the median value when given an array of numerical datatypes. More...
 
template<typename T >
double array_stdev (const T data[], const int array_size)
 This template function calculates and returns the standard deviation in double format when given an array of numerical datatypes. More...
 
template<typename T >
int array_which_median (const T data[], const int array_size)
 This template function determines which element in the data array has the median value of the dataset. More...
 
template<typename T >
double intpow (const T base, const int exponent)
 This template function calculates and returns the results of an integer power operation on a base numerical datatype. More...
 
template<typename T >
void outputVectorToFile (std::vector< T > &vec, std::string filename)
 This template function outputs the input data vector to a file with the specified filename. More...
 
template<typename T >
void outputVectorToFile (std::vector< std::pair< T, T >> &vec, std::string filename)
 This template function outputs the input data pair vector to a file with the specified filename. More...
 
template<typename T >
void removeDuplicates (std::vector< T > &vec)
 This template function efficienctly removes the duplicate entries from an input vector. More...
 
template<typename T , typename A >
double vector_avg (const std::vector< T, A > &data)
 This template function calculates and returns the average value in double format when given a vector of numerical datatypes. More...
 
template<typename T , typename A >
double vector_median (std::vector< T, A > data)
 This template function calculates and returns the median value when given a vector of numerical datatypes. More...
 
template<typename T , typename A >
double vector_stdev (const std::vector< T, A > &data)
 This template function calculates and returns the standard deviation in double format when given a vector of numerical datatypes. More...
 
template<typename T , typename A >
int vector_which_median (const std::vector< T, A > &data)
 This template function determines which element in the data vector is closest to the median value of the dataset. More...
 
std::ostream & operator<< (std::ostream &stream, const Version &input)
 

Variables

Version Current_version ("4.0.2")
 

Function Documentation

◆ array_avg()

template<typename T >
double Ising_OPV::array_avg ( const T  data[],
const int  array_size 
)

This template function calculates and returns the average value in double format when given an array of numerical datatypes.

Parameters
datais the array of numerical data.
array_sizeis the size of the input data array.
Returns
The average of the data set in double format.

◆ array_median()

template<typename T >
T Ising_OPV::array_median ( const T  data[],
const int  array_size 
)

This template function calculates and returns the median value when given an array of numerical datatypes.

Parameters
datais the array of numerical data.
array_sizeis the size of the input data array.
Returns
The median value of the data set.

◆ array_stdev()

template<typename T >
double Ising_OPV::array_stdev ( const T  data[],
const int  array_size 
)

This template function calculates and returns the standard deviation in double format when given an array of numerical datatypes.

Parameters
datais the input array of numerical data.
array_sizeis the size of the input data array.
Returns
The standard deviation of the data set in double format.

◆ array_which_median()

template<typename T >
int Ising_OPV::array_which_median ( const T  data[],
const int  array_size 
)

This template function determines which element in the data array has the median value of the dataset.

Parameters
datais the input array of numerical data.
array_sizeis the size of the input data array.
Returns
the integer array index that indicates the median value.
-1 if the median cannot be determined.

◆ calculateCumulativeHist()

std::vector< std::pair< double, double > > Ising_OPV::calculateCumulativeHist ( const std::vector< std::pair< double, double >> &  data)

Calculates the cumulative histogram from the input probability histogram data.

Parameters
datais the input probability histogram which is a vector of x-y pairs consisting of bin-centered x values and probability y values.
Returns
A vector of x-y pairs consisting of bin-centered x values and cumulative probability y values.

◆ calculateHist()

std::vector< std::pair< double, int > > Ising_OPV::calculateHist ( const std::vector< int > &  data,
int  bin_size 
)

Calculates the histogram for the input integer data vector using the input bin size.

Linearly spaced bins are automatically created from the minimum value to the maximum value of the data set with the specified bin size. The function outputs bin-centered x values and counts y values in a x-y pair vector.

Parameters
datais the input integer data vector.
bin_sizeis the specified bin size
Returns
A vector of x-y pairs consisting of bin-centered x values and counts y values.

◆ calculateProbabilityHist() [1/6]

std::vector< std::pair< double, double > > Ising_OPV::calculateProbabilityHist ( const std::vector< std::pair< double, int >>  hist)

Calculates the probability histogram for the input histogram data vector. The function outputs bin-centered x values and probability y values in a x-y pair vector.

Parameters
histis the input histogram data vector.
Returns
A vector of x-y pairs consisting of bin-centered x values and probability y values.

◆ calculateProbabilityHist() [2/6]

std::vector< std::pair< double, double > > Ising_OPV::calculateProbabilityHist ( const std::vector< int > &  data,
int  bin_size 
)

Calculates the probability histogram for the input integer data vector using the input bin size.

Linearly spaced bins are automatically created from the minimum value to the maximum value of the data set with the specified bin size. The function outputs bin-centered x values and probability y values in a x-y pair vector.

Parameters
datais the input integer data vector.
bin_sizeis the specified bin size
Returns
A vector of x-y pairs consisting of bin-centered x values and probability y values.

◆ calculateProbabilityHist() [3/6]

std::vector< std::pair< double, double > > Ising_OPV::calculateProbabilityHist ( const std::vector< double > &  data,
int  num_bins 
)

Calculates the probability histogram for the input double data vector using the input number of bins.

Linearly spaced bins are automatically created from the minimum value to the maximum value of the data set. The function outputs bin-centered x values and probability y values in a x-y pair vector.

Parameters
datais the input data vector.
num_binsis the desired number of bins.
Returns
A vector of x-y pairs consisting of bin-centered x values and probability y values.

◆ calculateProbabilityHist() [4/6]

std::vector< std::pair< double, double > > Ising_OPV::calculateProbabilityHist ( const std::vector< double > &  data,
double  bin_size 
)

Calculates the probability histogram for the input data vector using the input bin size.

Linearly spaced bins are automatically created from the minimum value to the maximum value of the data set. with the specified bin spacing. The function outputs bin-centered x values and probability y values in a x-y pair vector.

Parameters
datais the input data vector.
bin_sizeis the desired bin size.
Returns
A vector of x-y pairs consisting of bin-centered x values and probability y values.

◆ calculateProbabilityHist() [5/6]

std::vector< std::pair< double, double > > Ising_OPV::calculateProbabilityHist ( const std::vector< double > &  data,
const double  bin_size,
const int  num_bins 
)

Calculates the probability histogram for the input data vector using the input bin size and input number of bins.

Linearly spaced bins are automatically created starting from the minimum value of the data set. The function outputs bin-centered x values and probability y values in a x-y pair vector.

Parameters
datais the input data vector.
num_binsis the number of bins that will be created.
bin_sizeis the input bin size.
Returns
A vector of x-y pairs consisting of bin-centered x values and probability y values.

◆ calculateProbabilityHist() [6/6]

std::vector< std::pair< double, double > > Ising_OPV::calculateProbabilityHist ( const std::vector< double > &  data,
const double  bin_start,
const double  bin_size 
)

Calculates the probability histogram for the input data vector using the input bin start value and bin size.

Linearly spaced bins are automatically created starting from the bin start value. The function outputs bin-centered x values and probability y values in a x-y pair vector.

Parameters
datais the input data vector.
bin_startis the starting value of the first bin.
bin_sizeis the input bin size.
Returns
A vector of x-y pairs consisting of bin-centered x values and probability y values.

◆ integrateData()

double Ising_OPV::integrateData ( const std::vector< std::pair< double, double >> &  data)

Numerically integrates a vector of x-y data using the trapezoid rule.

Warning
The function assumes that the data is sorted by the x values.
Parameters
datais the data vector containing x-y data pairs.
Returns
the numerically calculated area.

◆ interpolateData()

double Ising_OPV::interpolateData ( const std::vector< std::pair< double, double >> &  data,
const double  x_val 
)

Linearly interpolates an x-y data set to determine the interpolated y-value corresponding to an input x-value.

Warning
The function assumes that the data is sorted by the x values.
Parameters
datais the data vector containing x-y data pairs.
x_valis the x-value that will be interpolated to.
Returns
the interpolated y-value when the input x-value lies within the range of the input data.

◆ intpow()

template<typename T >
double Ising_OPV::intpow ( const T  base,
const int  exponent 
)

This template function calculates and returns the results of an integer power operation on a base numerical datatype.

Parameters
baseis the base of the integer power operation and can be any numerical type.
exponentis the integer exponent for the integer power operation.
Returns
The result of the integer power operation in double format.

◆ MPI_calculateProbHistAvg()

std::vector< std::pair< double, double > > Ising_OPV::MPI_calculateProbHistAvg ( const std::vector< std::pair< double, int >> &  input_hist)

Uses MPI to calculate the average probability histogram from separate histograms coming from different processors.

Each processor calls this function and sends an input histogram. Each input histogram must have the same bin size.

Upon function return, processor 0 receives the average probabiliy histogram and all of the other processors receive an empty probability histogram.

Parameters
input_histis the input histogram data from the processor calling the function.
Returns
A pair vector that is the average probability histogram of all input histograms from each processor, when called on processor 0.
An empty vector when called on other processors.

◆ MPI_calculateVectorAvg()

std::vector< double > Ising_OPV::MPI_calculateVectorAvg ( const std::vector< double > &  input_vector)

Uses MPI to calculate the element-wise average vector from separate vectors coming from different processors.

Each processor calls this function and sends an input vector. If vectors are different sizes, the function uses trailing zeroes to make all vectors the same size before averaging. Upon function return, processor 0 receives the average vector and all of the other processors receive an empty vector.

Parameters
input_vectoris the input data from the processor calling the function.
Returns
A vector that is the element-wise average of all input vectors from each processor, when called on processor 0.
An empty vector when called on other processors.

◆ MPI_calculateVectorSum() [1/2]

std::vector< double > Ising_OPV::MPI_calculateVectorSum ( const std::vector< double > &  input_vector)

Uses MPI to calculate the element-wise sum vector from separate equally sized vectors coming from different processors.

Each processor calls this function and sends an input vector. Upon function return, processor 0 receives the sum vector and all of the other processors receive an empty vector.

Parameters
input_vectoris the input data from the processor calling the function.
Returns
A vector that is the element-wise sum of all input vectors from each processor, when called on processor 0.
An empty vector when called on other processors.

◆ MPI_calculateVectorSum() [2/2]

std::vector< int > Ising_OPV::MPI_calculateVectorSum ( const std::vector< int > &  input_vector)

Uses MPI to calculate the element-wise sum vector from separate vectors coming from different processors.

Each processor calls this function and sends an input vector. Upon function return, processor 0 receives the sum vector and all of the other processors receive an empty vector.

Parameters
input_vectoris the input data from the processor calling the function.
Returns
A vector that is the element-wise sum of all input vectors from each processor, when called on processor 0.
An empty vector when called on other processors.

◆ MPI_gatherValues() [1/2]

std::vector< int > Ising_OPV::MPI_gatherValues ( const int  input_val)

Uses MPI to gather integer values from separate processors to build one vector containing all of the data.

Each processor calls this function and sends an input value. Upon function return, processor 0 receives the data vector and all of the other processors receive an empty vector.

Parameters
input_valis the input integer data value from the processor calling the function.
Returns
A vector that is a collection of the values from each processor, when called on processor 0.
An empty vector when called on other processors.

◆ MPI_gatherValues() [2/2]

std::vector< double > Ising_OPV::MPI_gatherValues ( const double  input_val)

Uses MPI to gather double values from separate processors to build one vector containing all of the data.

Each processor calls this function and sends an input value. Upon function return, processor 0 receives the data vector and all of the other processors receive an empty vector.

Parameters
input_valis the input double data value from the processor calling the function.
Returns
A vector that is a collection of the values from each processor, when called on processor 0.
An empty vector when called on other processors.

◆ MPI_gatherVectors() [1/2]

std::vector< double > Ising_OPV::MPI_gatherVectors ( const std::vector< double > &  input_vector)

Uses MPI to gather vectors from separate processors to build one big vector containing all of the data.

Each processor calls this function and sends an input vector. Upon function return, processor 0 receives the large data vector and all of the other processors receive an empty vector.

Parameters
input_vectoris the input data from the processor calling the function.
Returns
A vector that is a concatenation of all input vectors from each processor, when called on processor 0.
An empty vector when called on other processors.

◆ MPI_gatherVectors() [2/2]

std::vector< int > Ising_OPV::MPI_gatherVectors ( const std::vector< int > &  input_vector)

Uses MPI to gather vectors from separate processors to build one big vector containing all of the data.

Each processor calls this function and sends an input vector. Upon function return, processor 0 receives the large data vector and all of the other processors receive an empty vector.

Parameters
input_vectoris the input data from the processor calling the function.
Returns
A vector that is a concatenation of all input vectors from each processor, when called on processor 0.
An empty vector when called on other processors.

◆ operator<<()

std::ostream& Ising_OPV::operator<< ( std::ostream &  stream,
const Version input 
)

◆ outputVectorToFile() [1/2]

template<typename T >
void Ising_OPV::outputVectorToFile ( std::vector< T > &  vec,
std::string  filename 
)

This template function outputs the input data vector to a file with the specified filename.

Warning
This function may overwrite existing files if not used carefully.
Parameters
vecis the input data vector.
filenameis the input file name.

◆ outputVectorToFile() [2/2]

template<typename T >
void Ising_OPV::outputVectorToFile ( std::vector< std::pair< T, T >> &  vec,
std::string  filename 
)

This template function outputs the input data pair vector to a file with the specified filename.

Warning
This function may overwrite existing files if not used carefully.
Parameters
vecis the input data pair vector.
filenameis the input file name.

◆ removeDuplicates()

template<typename T >
void Ising_OPV::removeDuplicates ( std::vector< T > &  vec)

This template function efficienctly removes the duplicate entries from an input vector.

This algorithm allow efficient removal of duplicate vector objects when > or < comparison operators do not exist.

Parameters
vecis the input vector to be operated on.

◆ removeWhitespace()

std::string Ising_OPV::removeWhitespace ( const std::string &  str)

Removes all spaces and ta characters in a string.

Parameters
stris the input string
Returns
a new string that will have the whitespace removed.

◆ round_int()

int Ising_OPV::round_int ( const double  num)

Rounds the input double value to the nearest integer value.

Parameters
numis the input double value.
Returns
an integer value that is the rounded value.

◆ str2bool()

bool Ising_OPV::str2bool ( const std::string &  input)

Extracts a boolean value from a string containing "true" or "false". Throws an invalid_argument exception if the input string is not "true" or "false".

Parameters
inputis the input string.
Returns
true if the input string is "true".
flase if the input string is "flase".

◆ vector_avg()

template<typename T , typename A >
double Ising_OPV::vector_avg ( const std::vector< T, A > &  data)

This template function calculates and returns the average value in double format when given a vector of numerical datatypes.

Parameters
datais the vector of numerical data.
Returns
The average of the data set in double format.

◆ vector_median()

template<typename T , typename A >
double Ising_OPV::vector_median ( std::vector< T, A >  data)

This template function calculates and returns the median value when given a vector of numerical datatypes.

Parameters
datais the vector of numerical data.
Returns
The median value in the data set.

◆ vector_stdev()

template<typename T , typename A >
double Ising_OPV::vector_stdev ( const std::vector< T, A > &  data)

This template function calculates and returns the standard deviation in double format when given a vector of numerical datatypes.

Parameters
datais the vector of numerical data.
Returns
The standard deviation of the data set in double format.

◆ vector_which_median()

template<typename T , typename A >
int Ising_OPV::vector_which_median ( const std::vector< T, A > &  data)

This template function determines which element in the data vector is closest to the median value of the dataset.

if multiple values are equally close, the first one in the vector is selected.

Parameters
datais the input vector of numerical data.
Returns
the integer vector index that indicates the median value.

Variable Documentation

◆ Current_version

Version Ising_OPV::Current_version