GraphNet: Discrete element modeling for network connected materials
Applications to polymeric networks
Public Member Functions | Public Attributes | List of all members
MPI_Network Class Reference

#include <mpi_network.h>

Inheritance diagram for MPI_Network:
Inheritance graph
[legend]
Collaboration diagram for MPI_Network:
Collaboration graph
[legend]

Public Member Functions

 MPI_Network ()
 Default constructor. More...
 
 MPI_Network (string &)
 
 MPI_Network (MPI_Network const &source)
 Copy constructor. More...
 
 MPI_Network (Network const &source)
 Constructor to initialize from a Network object Note: This constructor uses initialization lists for initializing the member data. More...
 
 MPI_Network (sacNetwork const &source)
 Constructor to initialize from a sacNetwork object Note: Since MPI_Network virtually (public) inherits from Network and publically inherits from sacNetwork (which itself virtual public inherits from Network), we need to initialize the base class (Network) object too. The constructors for virtual base classes are always called from the most derived class, using any arguments it might pass in. So, sacNetwork copy constructor will not call the base Network copy constructor. Therefore, we need to construct this object using base Network's copy constructor explicitly. More...
 
 ~MPI_Network ()
 Destructor. More...
 
void copy (MPI_Network const &source)
 Copies source's data members into current object. Called by copy constructor. More...
 
void clear ()
 Clears the extra variables instantiated in the MPI_Network object. Called by the destructor of the class. More...
 
void get_forces (bool) override
 Overrides the get_forces of parent classes (Network or sacNetwork) to calculate forces in its own chunk. More...
 
void init_MPI (int world_rank, int world_size)
 Chunks the graph using squares and ranking the squares using the process' rank in the MPI execution. More...
 
void rewrite_moving_nodes ()
 Rewrites moving nodes to include only nodes included in object's partition. More...
 
- Public Member Functions inherited from Network
 Network ()
 Implements a network of discrete chains. More...
 
 Network (Network const &source)
 Copy constuctor for class Network. More...
 
 Network (string &fname, bool from_dump=false)
 Constructor that instantiates a Network object according to given {fname} file. Please note that there are no checks made on the GMSH .msh filepath and that responsibility is left to the user. More...
 
virtual ~Network ()
 Destructor for class network. More...
 
Network const & operator= (Network const &other)
 Overloads assignment operator (=) to implement copy constructor. More...
 
virtual void build_network ()
 This function is for users to build custom networks. It has no body and implements nothing. More...
 
void side_nodes (float max_x=MAXBOUND_X, float max_y=MAXBOUND_Y)
 Gives the boundary nodes for a network. More...
 
void remove_duplicates (int &)
 Removes duplicate edges. A much more efficient version can be made of this program. But it is called only once in the simulation, so this should be fine. More...
 
void add_long_range_egdes_y (int, float)
 Adds y-directional long range edges to the network. Chooses two nodes uniformly at random from the n_add divisions in x_direction such that the distance between them is at least 0.25*L_MEAN and at max L_MEAN. More...
 
void add_long_range_egdes_random (int, float)
 Adds random long range edges to the network. Chooses two nodes uniformly at random and adds an edge with x/L = 0.25 (i.e. prestressed) More...
 
void load_from_dump (string &)
 This function loads the last network state from a dump file. This is called by the Network constructor load_from_dump is set to true. Do not load from dump if network has already broken. More...
 
void apply_crack (Cracklist &)
 Adds random cracks in the Network object. This is implemented by removing all connections and nodes that lie {entirely} within the ellipses specified in alist. Please note this assumption may be relaxed and a probabilistic measure may be introduced to remove some connections so as to simulate small world networks (cluster networks) This is managed by the PROB_REMOVAL parameter in params.h. More...
 
void make_edge_connections (float dely_allowed=10.0)
 Adds PBC bonds to the network according to dely_allowed. More...
 
virtual void move_top_plate ()
 Moves the top plate according to velocity supplied in vel.h. More...
 
virtual void get_plate_forces (float *, int)
 Writes the forces on the top plate the supplied plate_forces array. More...
 
virtual void optimize (float eta=0.1, float alpha=0.9, int max_iter=800)
 Equilibriates the Network object using RMSProp algorithm due to G. Hinton et al (a gradient based force minimization over each node). Stops when maximum force on node is less than TOL specified in params.h or max_iter is reached. More...
 
virtual void qd_optimize (float C=0.001, int max_iter=800)
 Equilibriates the Network object using an Implicit scheme based on solving the quasi-dynamic equation. More...
 
float get_weight ()
 Gets the total length of all polymer chains active in the network. More...
 
float set_weight (float)
 Sets the total length of all polymer chains according to supplied weight parameter. Also prints out the new average polymer contour lengths. More...
 
bool get_stats (float force_threshold=1000.0)
 Prints out certain statistics of the network object. More...
 
int get_current_edges ()
 Gets the active (load-bearing) edges in the Network object. Also prints out that info to STDOUT or piped OUT. More...
 
virtual void plotNetwork (int, bool)
 Plots the graph of the network. Note the edges in the graph just signify connection between two nodes and do not represent the actual polymer geometry in any sense. Note that this plot will be saved as .png file in the folder specified by FLDR_STRING in params.h. More...
 
void copy (Network const &source)
 Implements the body of the copy constuctor. Allocates memory and does the appropriate assignments. More...
 
void dump (int, bool first_time=false)
 Dumps the network information for an iteration in a file. Filename would be <FLDR_STRING>.txt with <FLDR_STRING taken from params.h If <FLDR_STRING>.txt exists, <FLDR_STRING>_i.txt would be created where i is an integer decided based on copies present in current folder. More...
 
- Public Member Functions inherited from sacNetwork
 sacNetwork ()
 Default constructor. More...
 
 ~sacNetwork ()
 Default destructor. More...
 
 sacNetwork (sacNetwork const &)
 Copy constructor. More...
 
 sacNetwork (string &fname, bool from_dump=false)
 Constructor that instantiates a sacNetwork object according to given {fname} file. Please note that there are no checks made on the GMSH .msh filepath and that responsibility is left to the user. More...
 
void clear ()
 Clears extra variables declared by sacNetwork object. Called by destructor. More...
 
void malloc_network ()
 Extends parent class' function to add memory allocation for extra class variables. More...
 
void load_network (string &)
 Overrides parent class' function to initialize extra variables. Called by sacNetwork(string& fname). More...
 

Public Attributes

int * chunk_nodes
 
int * chunk_edges
 
int chunk_edges_len
 
int chunk_nodes_len
 
int n_chunk_edges
 
- Public Attributes inherited from Network
bool cracked
 Flag to check if the network has cracks. More...
 
int n_nodes
 Stores number of crosslinker nodes in the network. More...
 
int n_elems
 Stores number of polymer connections in the network. More...
 
int n_rside
 Stores number of crosslinker nodes on the right edge of the network sample. More...
 
int n_lside
 Stores number of crosslinker nodes on the left edge of the network sample. More...
 
int n_bside
 Stores number of crosslinker nodes on the bottom edge of the network sample. More...
 
int n_tside
 Stores number of crosslinker nodes on the top edge of the network sample. More...
 
float * R
 Stores the position of all nodes of the graph in a flat n_nodes*DIM size array. More...
 
int * edges
 Stores the i,j pairs that form edges, size is n_elems*2. More...
 
float * forces
 Stores the forces on all nodes of the network in a flat n_nodes*DIM size array. More...
 
float * damage
 Stores the damage in each edge of the network. More...
 
float * L
 Stores the contour length of the edge. More...
 
bool * PBC
 Tag to check if an edge is a periodic boundary condition edge. More...
 
int * lsideNodes
 Stores index of crosslinker nodes on the left edge of the network sample. More...
 
int * rsideNodes
 Stores index of crosslinker nodes on the right edge of the network sample. More...
 
int * tsideNodes
 Stores index of crosslinker nodes on the top edge of the network sample. More...
 
int * bsideNodes
 Stores index of crosslinker nodes on the bottom edge of the network sample. More...
 
bool initialized
 Internal variable to check if Network object is initialized. More...
 
float __init_force
 Initial force on the plate (simulation stopped if force goes below this.) More...
 
float weight_multiplier = 1.0
 Weight multiplier in case of weight increases. More...
 
int iter_offset = 0
 Offsets iterations in the figure names, if starting where a previous simulation ended. More...
 
int * moving_nodes
 Stores index of all nodes where no boundary condition is applied (i.e. they participate in optimization) More...
 
int n_moving
 Stores number of moving nodes. More...
 
- Public Attributes inherited from sacNetwork
int * m
 
float * sacdamage
 

Constructor & Destructor Documentation

MPI_Network::MPI_Network ( )

Default constructor.

MPI_Network::MPI_Network ( string &  )
MPI_Network::MPI_Network ( MPI_Network const &  source)

Copy constructor.

MPI_Network::MPI_Network ( Network const &  source)

Constructor to initialize from a Network object Note: This constructor uses initialization lists for initializing the member data.

MPI_Network::MPI_Network ( sacNetwork const &  source)

Constructor to initialize from a sacNetwork object Note: Since MPI_Network virtually (public) inherits from Network and publically inherits from sacNetwork (which itself virtual public inherits from Network), we need to initialize the base class (Network) object too. The constructors for virtual base classes are always called from the most derived class, using any arguments it might pass in. So, sacNetwork copy constructor will not call the base Network copy constructor. Therefore, we need to construct this object using base Network's copy constructor explicitly.

MPI_Network::~MPI_Network ( )

Destructor.

Member Function Documentation

void MPI_Network::clear ( )
virtual

Clears the extra variables instantiated in the MPI_Network object. Called by the destructor of the class.

Reimplemented from Network.

void MPI_Network::copy ( MPI_Network const &  source)

Copies source's data members into current object. Called by copy constructor.

void MPI_Network::get_forces ( bool  update_damage = false)
overridevirtual

Overrides the get_forces of parent classes (Network or sacNetwork) to calculate forces in its own chunk.

Parameters
update_damage–> described in Network::get_forces

Reimplemented from Network.

void MPI_Network::init_MPI ( int  world_rank,
int  world_size 
)

Chunks the graph using squares and ranking the squares using the process' rank in the MPI execution.

Parameters
world_rank–> rank of the MPI process
world_size–> size of the MPI_Comm
void MPI_Network::rewrite_moving_nodes ( )

Rewrites moving nodes to include only nodes included in object's partition.

Member Data Documentation

int* MPI_Network::chunk_edges
int MPI_Network::chunk_edges_len
int* MPI_Network::chunk_nodes
int MPI_Network::chunk_nodes_len
int MPI_Network::n_chunk_edges

The documentation for this class was generated from the following files: