rod_structure.h
Go to the documentation of this file.
1 //
2 // This file is part of the FFEA simulation package
3 //
4 // Copyright (c) by the Theory and Development FFEA teams,
5 // as they appear in the README.md file.
6 //
7 // FFEA is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // FFEA is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with FFEA. If not, see <http://www.gnu.org/licenses/>.
19 //
20 // To help us fund FFEA development, we humbly ask that you cite
21 // the research papers on the package.
22 //
23 
24 /*
25  * rod_structure.h
26  * Author: Rob Welch, University of Leeds
27  * Email: py12rw@leeds.ac.uk
28  */
29 #ifndef ROD_STRUCTURE
30 #define ROD_STRUCTURE
31 
32 #include <iostream>
33 #include <fstream>
34 #include <cassert>
35 #include <boost/algorithm/string.hpp>
36 #include <string>
37 #include <vector>
38 #include "rod_math_v9.h"
39 #include <omp.h>
40 #include "RngStream.h"
41 #include <stdio.h>
42 
43 namespace rod {
44 
45 std::vector <float> stof_vec (std::vector <std::string> vec_in, int length);
46 struct Rod
47 {
49  int length;
51  int num_rods;
52  int rod_no;
53  int line_start = 0;
54  double rod_version = 999.999;
55  bool computed_rest_energy = false;
56 
58  float viscosity = 1;
59  float timestep = 0.002;
60  float kT = 0;
61  float perturbation_amount = 0.01;
68  float * equil_r;
69  float * equil_m;
70  float * current_r;
71  float * current_m;
80  float * material_params;
81  float * B_matrix;
83  float * applied_forces;
84  bool * pinned_nodes;
85  bool interface_at_start = false;
86  bool interface_at_end = false;
87  bool restarting = false;
94 
95  std::string rod_filename;
96  FILE * file_ptr;
97  int frame_no = 0;
98  int step_no = 0;
99  Rod (int length, int set_rod_no);
100  Rod (std::string path, int set_rod_no);
101  Rod set_units();
103  Rod do_timestep(RngStream rng[]);
104  Rod add_force(float force[4], int node_index);
105  Rod pin_node(bool pin_state, int node_index);
106  Rod load_header (std::string filename);
107  Rod load_contents (std::string filename);
109  Rod write_array (float * array_ptr, int array_len, float unit_scale_factor);
110  Rod write_mat_params_array(float *array_ptr, int array_len, float stretch_scale_factor, float twist_scale_factor, float length_scale_factor);
111  Rod change_filename(std::string new_filename);
113  Rod translate_rod(float* r, float translation_vec[3]);
114  Rod rotate_rod(float euler_angles[3]);
115  Rod scale_rod(float scale);
116  Rod get_centroid(float *r, float centroid[3]);
117  Rod get_min_max(float *r, OUT float min[3], float max[3]);
118  Rod get_p(int index, OUT float p[3], bool equil);
119 };
120 
121 } //end namespace
122 #endif
Rod get_p(int index, OUT float p[3], bool equil)
Definition: rod_structure.cpp:899
std::string rod_filename
Definition: rod_structure.h:95
double rod_version
Definition: rod_structure.h:54
Rod do_timestep(RngStream rng[])
Definition: rod_structure.cpp:165
float * perturbed_y_energy_positive
Definition: rod_structure.h:73
float * B_matrix
Definition: rod_structure.h:81
Rod translate_rod(float *r, float translation_vec[3])
Definition: rod_structure.cpp:792
Rod change_filename(std::string new_filename)
Definition: rod_structure.cpp:741
float * perturbed_y_energy_negative
Definition: rod_structure.h:77
float * equil_m
Definition: rod_structure.h:69
Definition: rod_structure.h:46
float * applied_forces
Definition: rod_structure.h:83
float * perturbed_z_energy_positive
Definition: rod_structure.h:74
std::vector< float > stof_vec(std::vector< std::string > vec_in)
Definition: rod_structure.cpp:48
float twist_constant_factor
Definition: rod_structure.h:92
int line_start
Definition: rod_structure.h:53
bool restarting
Definition: rod_structure.h:87
Rod write_frame_to_file()
Definition: rod_structure.cpp:676
Rod load_contents(std::string filename)
Definition: rod_structure.cpp:604
float * twisted_energy_negative
Definition: rod_structure.h:79
Rod get_min_max(float *r, OUT float min[3], float max[3])
Definition: rod_structure.cpp:887
float spring_constant_factor
Definition: rod_structure.h:91
float * twisted_energy_positive
Definition: rod_structure.h:75
float kT
Definition: rod_structure.h:60
const scalar force
force = E/l
Definition: dimensions.h:37
Rod pin_node(bool pin_state, int node_index)
float rotational_friction
Definition: rod_structure.h:64
Definition: rod_blob_interface.cpp:38
Rod get_centroid(float *r, float centroid[3])
Definition: rod_structure.cpp:876
Rod write_array(float *array_ptr, int array_len, float unit_scale_factor)
Definition: rod_structure.cpp:705
bool interface_at_start
Definition: rod_structure.h:85
Rod compute_rest_energy()
Rod load_header(std::string filename)
Definition: rod_structure.cpp:503
float translational_friction
Definition: rod_structure.h:63
Definition: RngStream.h:43
bool * pinned_nodes
Definition: rod_structure.h:84
float * perturbed_z_energy_negative
Definition: rod_structure.h:78
int num_elements
Definition: rod_structure.h:50
float timestep
Definition: rod_structure.h:59
Rod write_mat_params_array(float *array_ptr, int array_len, float stretch_scale_factor, float twist_scale_factor, float length_scale_factor)
Definition: rod_structure.cpp:722
Rod set_units()
Definition: rod_structure.cpp:112
int step_no
Definition: rod_structure.h:98
float * material_params
Definition: rod_structure.h:80
int rod_no
Definition: rod_structure.h:52
Rod(int length, int set_rod_no)
Definition: rod_structure.cpp:73
float * equil_r
Definition: rod_structure.h:68
float * perturbed_x_energy_positive
Definition: rod_structure.h:72
int num_rods
Definition: rod_structure.h:51
Rod rotate_rod(float euler_angles[3])
Definition: rod_structure.cpp:808
FILE * file_ptr
Definition: rod_structure.h:96
float bending_response_factor
Definition: rod_structure.h:90
float viscosity_constant_factor
Definition: rod_structure.h:93
float * perturbed_x_energy_negative
Definition: rod_structure.h:76
const scalar length
length = C atom VdW radius
Definition: dimensions.h:31
int frame_no
Definition: rod_structure.h:97
Rod scale_rod(float scale)
Definition: rod_structure.cpp:860
float * current_r
Definition: rod_structure.h:70
Rod equilibrate_rod(RngStream rng[])
Definition: rod_structure.cpp:778
#define OUT
This is used to denote when a function modifies one of its parameters.
Definition: rod_math_v9.h:32
float viscosity
Definition: rod_structure.h:58
float perturbation_amount
Definition: rod_structure.h:61
Rod add_force(float force[4], int node_index)
Definition: rod_structure.cpp:589
bool interface_at_end
Definition: rod_structure.h:86
float * current_m
Definition: rod_structure.h:71
bool computed_rest_energy
Definition: rod_structure.h:55
int length
Definition: rod_structure.h:49