My Project
material.hh
Go to the documentation of this file.
1 //==============================================================================
11 //==============================================================================
12 #ifndef MATERIAL_HH_
13 #define MATERIAL_HH_
14 
15 #include <opm/common/utility/platform_dependent/disable_warnings.h>
16 
17 #include <dune/common/fmatrix.hh>
18 #include <dune/common/dynvector.hh>
19 
20 #include <opm/common/utility/platform_dependent/reenable_warnings.h>
21 
22 namespace Opm {
23 namespace Elasticity {
24 
25 
32 class Material
33 {
34 protected:
36  Material(int ID = 0, double density = 0.0)
37  : id(ID), rho(density)
38  {
39  }
40 
42  virtual std::ostream& write(std::ostream& os) const
43  {
44  return os;
45  }
46 public:
48  virtual ~Material() {}
49 
51  int num() const
52  {
53  return id;
54  }
55 
57  virtual int numPar() const = 0;
59  virtual double getPar(int /* ipar */ = 1) const
60  {
61  return double(0);
62  }
63 
67  virtual bool getConstitutiveMatrix(Dune::FieldMatrix<double,6,6>& C,
68  bool invers = false) const = 0;
69 
73  virtual bool getConstitutiveMatrix(Dune::FieldMatrix<double,3,3>& C,
74  bool invers = false) const = 0;
75 
77  double getMassDensity() const
78  {
79  return rho;
80  }
81 
83  friend std::ostream& operator<<(std::ostream& os, const Material& m)
84  {
85  return m.write(os);
86  }
87 
92  static Material* create(int ID, const Dune::DynamicVector<double>& params);
93 
97  static Material* create(int ID, const std::string& file);
98 private:
99  int id;
100  double rho;
101 };
102 
103 }
104 }
105 
106 #endif
This is a base class for linear elastic materials.
Definition: material.hh:33
virtual std::ostream & write(std::ostream &os) const
Prints the material properties to a stream.
Definition: material.hh:42
static Material * create(int ID, const Dune::DynamicVector< double > &params)
Creates a material object of a given type.
Definition: material.cpp:23
int num() const
Returns the external material id.
Definition: material.hh:51
virtual bool getConstitutiveMatrix(Dune::FieldMatrix< double, 3, 3 > &C, bool invers=false) const =0
Establishes the full constitutive matrix for this material.
virtual int numPar() const =0
Returns the number of parameters describing this material.
friend std::ostream & operator<<(std::ostream &os, const Material &m)
Global stream operator printing a material properties object.
Definition: material.hh:83
double getMassDensity() const
Returns the mass density of this material.
Definition: material.hh:77
Material(int ID=0, double density=0.0)
Default constructor creating an empty material.
Definition: material.hh:36
virtual ~Material()
Empty virtual destructor.
Definition: material.hh:48
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=1) const
Returns the ipar'th parameter describing this material.
Definition: material.hh:59
Inverting small matrices.
Definition: ImplicitAssembly.hpp:43