Karamelo  714599e9
Parallel Material Point Method Simulator
domain.h
1 /* -*- c++ -*- ----------------------------------------------------------
2  *
3  * *** Karamelo ***
4  * Parallel Material Point Method Simulator
5  *
6  * Copyright (2019) Alban de Vaucorbeil, alban.devaucorbeil@monash.edu
7  * Materials Science and Engineering, Monash University
8  * Clayton VIC 3800, Australia
9 
10  * This software is distributed under the GNU General Public License.
11  *
12  * ----------------------------------------------------------------------- */
13 
14 #ifndef LMP_DOMAIN_H
15 #define LMP_DOMAIN_H
16 
17 #include "pointers.h"
18 #include "region.h"
19 #include "solid.h"
20 #include <Eigen/Eigen>
21 #include <map>
22 #include <math.h>
23 #include <string>
24 #include <vector>
25 
26 using namespace std;
27 
34 class Domain : protected Pointers {
35  public:
36  int dimension;
37  bool created;
38  bool axisymmetric;
39  tagint np_total;
40 
41  double boxlo[3];
42  double boxhi[3];
43  double sublo[3];
44  double subhi[3];
45 
46  vector<class Region *> regions;
47  vector<class Solid *> solids;
48 
49  class Grid *grid;
50 
51  Domain(class MPM *);
52  virtual ~Domain();
53 
54  void create_domain(vector<string>);
55  void set_dimension(vector<string>);
56  void set_axisymmetric(vector<string>);
57  bool inside_subdomain(double, double, double);
58  bool inside_subdomain_extended(double, double, double, double);
59  void set_local_box();
60  void add_region(vector<string>);
61  int find_region(string);
62  void add_solid(vector<string>);
63  int find_solid(string);
64 
65  typedef Region *(*RegionCreator)(MPM *, vector<string>);
66  typedef map<string, RegionCreator> RegionCreatorMap;
67  RegionCreatorMap *region_map;
68 
69  // typedef Solid *(*SolidCreator)(MPM *,vector<string>);
70  // typedef map<string,SolidCreator> SolidCreatorMap;
71  // SolidCreatorMap *solid_map;
72 
73  int inside(Eigen::Vector3d);
74 
75 private:
76  template <typename T> static Region *region_creator(MPM *, vector<string>);
77  // template <typename T> static Solid *solid_creator(MPM *,vector<string>);
78 
79  const map<string, string> usage_dimension = {
80  {"1", "Usage: dimension(1, domain xmin, domain xmax, cell size)\n"},
81  {"2", "Usage: dimension(2, domain xmin, domain xmax, domain ymin, domain "
82  "ymax, cell size)\n"},
83  {"3", "Usage: dimension(3, domain xmin, domain xmax, domain ymin, domain "
84  "ymax, domain zmin, domain zmax, cell size)\n"}};
85 
86  const map<string, int> Nargs_dimension = {
87  {"1", 4}, {"2", 6}, {"2_axis", 7}, {"3", 8}};
88 
89  string usage_axisymmetric = "axisymmetric(true) or axisymmetric(false)\n";
90 };
91 
92 #endif
93 
tagint np_total
total number of particles
Definition: domain.h:39
bool axisymmetric
true if axisymmetric, false otherwise
Definition: domain.h:38
vector< class Solid * > solids
list of defined Solids
Definition: domain.h:47
class Grid * grid
pointer to the common background grid (if using Updated Lagrangian)
Definition: domain.h:49
Definition: mpm.h:29
Definition: grid.h:54
Definition: region.h:28
RegionCreatorMap * region_map
Map of all the known region types.
Definition: domain.h:67
bool created
has the domain been created?
Definition: domain.h:37
Definition: domain.h:34
int dimension
1 == 1D, 2 == 2d, 3 == 3d
Definition: domain.h:36
Definition: pointers.h:29
vector< class Region * > regions
list of defined Regions
Definition: domain.h:46