1 /*!
2  * \file   mfront/include/MFront/EuroplexusInterface.hxx
3  * \brief  This file declares the EuroplexusInterface class
4  * \author Thomas Helfer
5  * \date   17 Jan 2007
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_EUROPLEXUSINTERFACE_HXX
15 #define LIB_MFRONT_EUROPLEXUSINTERFACE_HXX
16 
17 #include <string>
18 #include <iosfwd>
19 
20 #include "TFEL/Utilities/CxxTokenizer.hxx"
21 #include "MFront/UMATInterfaceBase.hxx"
22 
23 namespace mfront {
24 
25   /*!
26    * \brief the interface the Europlexus Standard finite element solver
27    */
28   struct EuroplexusInterface : public UMATInterfaceBase {
29     //! name of finite strain strategy attribute
30     static const char *const finiteStrainStrategy;
31     //! return the name of the interface
32     static std::string getName();
33     /*!
34      * \return true if a finite strain strategy has been set up
35      * \param[in] bd: behaviour description
36      */
37     static bool hasFiniteStrainStrategy(const BehaviourDescription&);
38     /*!
39      * \param[in,out] mb: behaviour description
40      * \param[in] k  : keyword treated
41      * \param[in] i:  list of interfaces to which the keyword is restricted
42      * \param[in] p  : iterator to the current token
43      * \param[in] pe : iterator past the end of the file
44      * \return a pair. The first entry is true if the keyword was
45      * treated by the interface. The second entry is an iterator after
46      * the last token treated.
47      */
48     std::pair<bool, tokens_iterator> treatKeyword(
49         BehaviourDescription &,
50         const std::string &,
51         const std::vector<std::string> &,
52         tokens_iterator,
53         const tokens_iterator) override;
54     /*!
55      * \brief write output files
56      * \param[in] mb        : mechanical behaviour description
57      * \param[in] fd        : mfront file description
58      */
59     void endTreatment(const BehaviourDescription &,
60                       const FileDescription &) const override;
61     /*!
62      * \param[out] d  : target description
63      * \param[out] bd : behaviour description
64      */
65     void getTargetsDescription(TargetsDescription &,
66                                const BehaviourDescription &) override;
67     //! destructor
68     ~EuroplexusInterface() override;
69 
70    protected:
71     std::string getLibraryName(const BehaviourDescription &) const override;
72     std::string getInterfaceName() const override;
73     void writeBehaviourDataMainVariablesSetters(
74         std::ostream &, const BehaviourDescription &) const override;
75     void writeBehaviourDataGradientSetter(
76         std::ostream &,
77         const Gradient &,
78         const SupportedTypes::TypeSize) const override;
79     void writeIntegrationDataGradientSetter(
80         std::ostream &,
81         const Gradient &,
82         const SupportedTypes::TypeSize) const override;
83     void exportThermodynamicForce(
84         std::ostream &,
85         const std::string &,
86         const ThermodynamicForce &,
87         const SupportedTypes::TypeSize) const override;
88     std::string getFunctionNameBasis(const std::string &) const override;
89     void writeMTestFileGeneratorSetModellingHypothesis(
90         std::ostream &) const override;
91     /*!
92      * \brief write a  specialisation of the EuroplexusTraits class
93      * \param[in] out : ouptut file
94      * \param[in] mb  : behaviour description
95      * \param[in] h   : modelling hypothesis
96      */
97     virtual void writeEuroplexusBehaviourTraits(std::ostream &,
98                                                 const BehaviourDescription &,
99                                                 const Hypothesis) const;
100     void writeInterfaceSpecificIncludes(
101         std::ostream &, const BehaviourDescription &) const override;
102     void writeBehaviourDataThermodynamicForceSetter(
103         std::ostream &,
104         const ThermodynamicForce &,
105         const SupportedTypes::TypeSize) const override;
106     /*!
107      * \param[in] out  : output file
108      * \param[in] mb   : behaviour description
109      * \param[in] name : name of the behaviour as defined by interface
110      *                   (generally taking into account the material
111      *                    and the behaviour name)
112      */
113     virtual void writeFiniteRotationSmallStrainCall(
114         std::ostream &,
115         const BehaviourDescription &,
116         const std::string &) const;
117     /*!
118      * \param[in] out  : output file
119      * \param[in] mb   : behaviour description
120      * \param[in] name : name of the behaviour as defined by interface
121      *                   (generally taking into account the material
122      *                    and the behaviour name)
123      */
124     virtual void writeLogarithmicStrainCall(std::ostream &,
125                                             const BehaviourDescription &,
126                                             const std::string &) const;
127 
128     virtual std::string getModellingHypothesisTest(
129         const Hypothesis) const override;
130 
131     virtual std::map<UMATInterfaceBase::Hypothesis, std::string>
132     gatherModellingHypothesesAndTests(
133         const BehaviourDescription &) const override;
134     /*!
135      * \return the list of modelling hypotheses treated by the interface
136      * \param[in] mb : behaviour description
137      */
138     virtual std::set<Hypothesis> getModellingHypothesesToBeTreated(
139         const BehaviourDescription &) const override;
140   };  // end of EuroplexusInterface
141 
142 }  // end of namespace mfront
143 
144 #endif /* LIB_MFRONT_EUROPLEXUSINTERFACE_HXX */
145