material.hh
Go to the documentation of this file.
1 //==============================================================================
11 //==============================================================================
12 #ifndef MATERIAL_HH_
13 #define MATERIAL_HH_
14 
15 #include <dune/common/fmatrix.hh>
16 #include <dune/common/dynvector.hh>
17 
18 namespace Opm {
19 namespace Elasticity {
20 
21 
28 class Material
29 {
30 protected:
32  Material(int ID = 0, double density = 0.0)
33  : id(ID), rho(density)
34  {
35  }
36 
38  virtual std::ostream& write(std::ostream& os) const
39  {
40  return os;
41  }
42 public:
44  virtual ~Material() {}
45 
47  int num() const
48  {
49  return id;
50  }
51 
53  virtual int numPar() const = 0;
55  virtual double getPar(int ipar = 1) const
56  {
57  return double(0);
58  }
59 
63  virtual bool getConstitutiveMatrix(Dune::FieldMatrix<double,6,6>& C,
64  bool invers = false) const = 0;
65 
69  virtual bool getConstitutiveMatrix(Dune::FieldMatrix<double,3,3>& C,
70  bool invers = false) const = 0;
71 
73  double getMassDensity() const
74  {
75  return rho;
76  }
77 
79  friend std::ostream& operator<<(std::ostream& os, const Material& m)
80  {
81  return m.write(os);
82  }
83 
88  static Material* create(int ID, const Dune::DynamicVector<double>& params);
89 
93  static Material* create(int ID, const std::string& file);
94 private:
95  int id;
96  double rho;
97 };
98 
99 }
100 }
101 
102 #endif
virtual std::ostream & write(std::ostream &os) const
Prints the material properties to a stream.
Definition: material.hh:38
Definition: applier.hpp:18
virtual int numPar() const =0
Returns the number of parameters describing this material.
This is a base class for linear elastic materials.
Definition: material.hh:28
static Material * create(int ID, const Dune::DynamicVector< double > &params)
Creates a material object of a given type.
int num() const
Returns the external material id.
Definition: material.hh:47
friend std::ostream & operator<<(std::ostream &os, const Material &m)
Global stream operator printing a material properties object.
Definition: material.hh:79
Material(int ID=0, double density=0.0)
Default constructor creating an empty material.
Definition: material.hh:32
double getMassDensity() const
Returns the mass density of this material.
Definition: material.hh:73
virtual bool getConstitutiveMatrix(Dune::FieldMatrix< double, 6, 6 > &C, bool invers=false) const =0
Establishes the full constitutive matrix for this material.
virtual double getPar(int ipar=1) const
Returns the ipar'th parameter describing this material.
Definition: material.hh:55
virtual ~Material()
Empty virtual destructor.
Definition: material.hh:44