PreComp_solver.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 #ifndef PRECOMP_H_INCLUDED
25 #define PRECOMP_H_INCLUDED
26 
27 #include <string>
28 #include <vector>
29 #include <sstream>
30 #include <fstream>
31 #include <iostream>
32 #include <math.h>
33 #include <boost/algorithm/string.hpp>
34 #include <algorithm>
35 
36 #include "FFEA_return_codes.h"
37 #include "dimensions.h"
38 #include "FFEA_user_info.h"
39 #include "mat_vec_types.h"
40 #include "LinkedListCube.h"
41 #include "SimulationParams.h"
42 
43 // WARNING: Blob.h will be included after defining PreComp_params!
44 
45 using namespace std;
46 
47 #include "Blob.h"
48 
50 public:
52  ~PreComp_solver();
53  int init(PreComp_params *pc_params, SimulationParams *params, Blob **blob_array);
54  int solve(scalar *blob_corr=NULL);
55  int solve_using_neighbours();
56  int solve_using_neighbours_non_critical(scalar *blob_corr=NULL);
57  void reset_fieldenergy();
58  scalar get_U(scalar x, int typei, int typej);
59  scalar get_F(scalar x, int typei, int typej);
60  scalar get_field_energy(int index0, int index1);
61 
62  int compute_bead_positions();
63 
64  int build_pc_nearest_neighbour_lookup();
65  int prebuild_pc_nearest_neighbour_lookup_and_swap();
66  int prebuild_pc_nearest_neighbour_lookup();
67  int safely_swap_pc_layers();
68 
69  void write_beads_to_file(FILE *fout, int timestep);
70 
71 private:
73  int msgc;
74  int msg(string whatever);
75  int msg(int whatever);
76 
77  int read_tabulated_values(PreComp_params &pc_params, string kind, scalar *Z, scalar scale_Z);
78 
79  int calc_force_from_pot();
80 
81  scalar finterpolate(scalar *Z, scalar x, int typei, int typej);
82 
83  // stuff related to the LinkedLists:
86  int pcVoxelsInBox[3];
87  static const int adjacent_cells[27][3];
88 
89 
93  scalar x_range[2];
95  scalar x_range2[2];
97  int n_values;
99  int nint;
101  int ntypes;
108  TELPtr *b_elems;
109  TELPtr *b_unq_elems;
111  int *b_types;
115  int n_beads;
125  int *b_daddyblob;
128 
130  vector<string> stypes;
131  int *b_elems_ndx;
132  int *b_blob_ndx;
133 
134 
139 
140 };
141 
142 #endif
Definition: tetra_element_linear.h:136
bool * isPairActive
Definition: PreComp_solver.h:127
scalar * b_pos
Definition: PreComp_solver.h:121
TELPtr * b_unq_elems
Definition: PreComp_solver.h:109
tetra_element_linear * TELPtr
Definition: PreComp_solver.h:107
Definition: Blob.h:94
int num_blobs
Definition: PreComp_solver.h:137
scalar * F
Definition: PreComp_solver.h:105
TELPtr * b_elems
Definition: PreComp_solver.h:108
int msgc
Definition: PreComp_solver.h:73
int num_diff_elems
Definition: PreComp_solver.h:117
Definition: PreComp_solver.h:49
int * b_types
Definition: PreComp_solver.h:111
STL namespace.
int * b_daddyblob
Definition: PreComp_solver.h:125
Definition: SimulationParams.h:66
static const int x
Definition: rod_math_v9.h:52
int * map_e_to_b
Definition: PreComp_solver.h:113
scalar Dx
Definition: PreComp_solver.h:91
scalar * fieldenergy
Definition: PreComp_solver.h:136
int * b_elems_ndx
array with the corresponding element index.
Definition: PreComp_solver.h:131
vector< string > stypes
string types for the beads; sorry it is a c++ vector
Definition: PreComp_solver.h:130
int * b_blob_ndx
array with the corresponding blob index.
Definition: PreComp_solver.h:132
int n_beads
Definition: PreComp_solver.h:115
scalar * b_rel_pos
Definition: PreComp_solver.h:119
int ntypes
Definition: PreComp_solver.h:101
int n_values
Definition: PreComp_solver.h:97
scalar * U
Definition: PreComp_solver.h:103
Definition: SimulationParams.h:75
int num_threads
Definition: PreComp_solver.h:138
LinkedListCube< int > pcLookUp
the linkedlist itself
Definition: PreComp_solver.h:84
scalar * b_forces
Definition: PreComp_solver.h:123
double scalar
Definition: mat_vec_types.h:36
scalar pcVoxelSize
the size of the voxels.
Definition: PreComp_solver.h:85
int nint
Definition: PreComp_solver.h:99