1 /*!
2  * \file   include/MFront/BehaviourBrick/PorosityNucleationModel.hxx
3  * \brief
4  * \author Thomas Helfer
5  * \date   15/03/2018
6  * \copyright Copyright (C) 2006-2018 CEA/DEN, EDF R&D. All rights
7  * reserved.
8  * This project is publicly released under either the GNU GPL Licence
9  * or the CECILL-A licence. A copy of thoses licences are delivered
10  * with the sources of TFEL. CEA or EDF may also distribute this
11  * project under specific licensing conditions.
12  */
13 
14 #ifndef LIB_MFRONT_BEHAVIOURBRICK_POROSITYNUCLEATIONMODEL_HXX
15 #define LIB_MFRONT_BEHAVIOURBRICK_POROSITYNUCLEATIONMODEL_HXX
16 
17 #include <memory>
18 #include "TFEL/Material/ModellingHypothesis.hxx"
19 #include "MFront/MFrontConfig.hxx"
20 #include "MFront/BehaviourDescription.hxx"
21 
22 namespace tfel {
23   namespace utilities {
24     // forward declaration
25     struct Data;
26   }  // end of namespace utilities
27 }  // end of namespace tfel
28 
29 namespace mfront {
30 
31   // forward declaration
32   struct AbstractBehaviourDSL;
33 
34   namespace bbrick {
35 
36     // forward declaration
37     struct StressPotential;
38     // forward declaration
39     struct InelasticFlow;
40     // forward declaration
41     struct OptionDescription;
42 
43     //! \brief class describing an inelastic flow.
44     struct MFRONT_VISIBILITY_EXPORT PorosityNucleationModel {
45       //! a simple alias
46       using Data = tfel::utilities::Data;
47       //! a simple alias
48       using DataMap = std::map<std::string, Data>;
49       //! a simple alias
50       using ModellingHypothesis = tfel::material::ModellingHypothesis;
51       /*!
52        * \return the name of a variable from a base name and the nucleation
53        * model id.
54        * \param[in] n: base name
55        * \param[in] id: nucleation model id
56        */
57       static std::string getVariableId(const std::string&, const std::string&);
58       /*!
59        * \param[in,out] bd: behaviour description
60        * \param[in,out] dsl: abstract behaviour dsl
61        * \param[in] id: porosity nucleation model id
62        * \param[in] d: options
63        */
64       virtual void initialize(BehaviourDescription&,
65                               AbstractBehaviourDSL&,
66                               const std::string&,
67                               const DataMap&) = 0;
68       //! \return the flow options
69       virtual std::vector<OptionDescription> getOptions() const = 0;
70       /*!
71        * \brief complete the variable description
72        * \param[in/out] bd: behaviour description
73        * \param[in] dsl: abstract behaviour dsl
74        * \param[in] iflows: list of inelastic flows and their associated ids
75        * \param[in] id: porosity nucleation model id
76        */
77       virtual void completeVariableDeclaration(
78           BehaviourDescription&,
79           const AbstractBehaviourDSL&,
80           const std::map<std::string, std::shared_ptr<bbrick::InelasticFlow>>&,
81           const std::string&) const = 0;
82       /*!
83        * \brief method called at the end of the input file processing
84        * \param[in] dsl: abstract behaviour dsl
85        * \param[in] bd: behaviour description
86        * \param[in] sp: stress potential
87        * \param[in] iflows: list of inelastic flows and their associated ids
88        * \param[in] id: porosity nucleation model id
89        */
90       virtual void endTreatment(
91           BehaviourDescription&,
92           const AbstractBehaviourDSL&,
93           const StressPotential&,
94           const std::map<std::string, std::shared_ptr<bbrick::InelasticFlow>>&,
95           const std::string&) const = 0;
96       /*!
97        * \return the code updating the next estimate of the porosity
98        * increment with the contribution of this nucleation model.
99        * \param[in] bd: behaviour description
100        * \param[in] iflows: list of inelastic flows and their associated ids
101        * \param[in] id: porosity nucleation model id
102        */
103       virtual std::string updateNextEstimateOfThePorosityIncrement(
104           const BehaviourDescription&,
105           const std::map<std::string, std::shared_ptr<bbrick::InelasticFlow>>&,
106           const std::string&) const = 0;
107       //! destructor
108       virtual ~PorosityNucleationModel();
109 
110     };  // end of struct PorosityNucleationModel
111 
112   }  // end of namespace bbrick
113 
114 }  // end of namespace mfront
115 
116 #endif /* LIB_MFRONT_BEHAVIOURBRICK_POROSITYNUCLEATIONMODEL_HXX */
117