NLMech  0.1.0
baseMaterial.h
1 // Copyright (c) 2019 Prashant K. Jha
3 // Copyright (c) 2019 Patrick Diehl
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See accompanying
6 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 
9 #ifndef MATERIAL_PD_BASEMATERIAL_H
10 #define MATERIAL_PD_BASEMATERIAL_H
11 
12 #include <cstring>
13 #include <vector>
14 
15 #include "util/point.h"
16 
17 namespace material {
18 
19 namespace pd {
20 
26 class BaseMaterial {
27 
28 public:
34  BaseMaterial(const size_t &dim, const double &horizon)
35  : d_horizon(horizon), d_dimension(dim), d_stateActive(false), d_density
36  (0.), d_name (""){};
37 
42  bool isStateActive() const { return d_stateActive; };
43 
48  std::string name() const {return d_name;};
49 
57  virtual std::pair<util::Point3,double> getBondEF(size_t i , size_t j){
58 
59  return std::make_pair(util::Point3(), 0.);
60 
61  };
62 
69  virtual double getS(const util::Point3 &dx, const util::Point3 &du) {
70  return
71  0.;
72  };
73 
80  virtual double getS(size_t i, size_t j) { return 0.; };
81 
87  virtual double getSc(const double &r) { return 0.; };
88 
96  virtual double getSc(size_t i , size_t j) { return 0.; };
97 
105  const util::Point3 &du) const {return
106  util::Point3(); }
107 
114  virtual util::Matrix33 getStrain(size_t i) {
115 
116  return util::Matrix33();
117  }
118 
125  virtual util::Matrix33 getStress(size_t i) {
126 
127  return util::Matrix33();
128  }
129 
134  virtual void update(){}
135 
142  virtual double getInfFn(const double &r) const {return 0.; };
143 
149  double getHorizon() const {
150  return d_horizon;
151  }
152 
157  double getDensity() const {return d_density; };
158 
168  virtual std::string printStr(int nt = 0, int lvl = 0) const {
169  // TODO implement
170  return "BaseMaterial";
171  };
172 
180  virtual void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt,
181  lvl); };
182 
183 protected:
184 
186  double d_horizon;
187 
189  size_t d_dimension;
190 
193 
195  double d_density;
196 
198  std::string d_name;
199 };
200 
201 } // namespace pd
202 
203 } // namespace material
204 
205 #endif // MATERIAL_PD_BASEMATERIAL_H
A base class providing methods to compute energy density and force.
Definition: baseMaterial.h:26
double getHorizon() const
Returns horizon.
Definition: baseMaterial.h:149
size_t d_dimension
Dimension.
Definition: baseMaterial.h:189
virtual util::Matrix33 getStress(size_t i)
Returns stress tensor.
Definition: baseMaterial.h:125
virtual void print(int nt=0, int lvl=0) const
Prints the information about the instance of the object.
Definition: baseMaterial.h:180
virtual double getSc(size_t i, size_t j)
Returns critical bond strain.
Definition: baseMaterial.h:96
double d_density
Density.
Definition: baseMaterial.h:195
bool d_stateActive
Flag indicating if peridynamic state potential is active.
Definition: baseMaterial.h:192
virtual void update()
Let the material class in the quasi-static case know that there is a new loading step.
Definition: baseMaterial.h:134
double d_horizon
Horizon.
Definition: baseMaterial.h:181
double getDensity() const
Returns the density of the material.
Definition: baseMaterial.h:157
virtual util::Point3 getBondForceDirection(const util::Point3 &dx, const util::Point3 &du) const
Get direction of bond force.
Definition: baseMaterial.h:104
virtual std::pair< util::Point3, double > getBondEF(size_t i, size_t j)
Returns energy and force between bond.
Definition: baseMaterial.h:57
std::string d_name
Name of material.
Definition: baseMaterial.h:198
std::string name() const
Returns name of the material.
Definition: baseMaterial.h:48
virtual std::string printStr(int nt=0, int lvl=0) const
Returns the string containing information about the instance of the object.
Definition: baseMaterial.h:168
bool isStateActive() const
Returns true if state-based potential is active.
Definition: baseMaterial.h:42
virtual util::Matrix33 getStrain(size_t i)
Returns strain tensor.
Definition: baseMaterial.h:114
virtual double getInfFn(const double &r) const
Returns the value of influence function.
Definition: baseMaterial.h:142
BaseMaterial(const size_t &dim, const double &horizon)
Constructor.
Definition: baseMaterial.h:34
virtual double getSc(const double &r)
Returns critical bond strain.
Definition: baseMaterial.h:87
virtual double getS(size_t i, size_t j)
Returns the bond strain.
Definition: baseMaterial.h:80
virtual double getS(const util::Point3 &dx, const util::Point3 &du)
Returns the bond strain.
Definition: baseMaterial.h:69
blaze::StaticMatrix< double, 3UL, 3UL > Matrix33
Blaze: Definition of 3 x 3 matrix.
Definition: matrixBlaze.h:23
A structure to represent 3d vectors.
Definition: point.h:29