1 /*! 2 * \file AbaqusInterfaceBase.hxx 3 * \brief 4 * \author Thomas Helfer 5 * \date 17 mars 2016 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_ABAQUSINTERFACEBASE_HXX 15 #define LIB_MFRONT_ABAQUSINTERFACEBASE_HXX 16 17 #include <string> 18 #include <iosfwd> 19 20 #include "MFront/UMATInterfaceBase.hxx" 21 22 namespace mfront { 23 24 /*! 25 * \brief base class for the interfaces to: 26 * - the Abaqus Standard finite element solver (see `AbaqusInterface`) 27 * - the Abaqus Explicit finite element solver (see `AbaqusExplicitInterface`) 28 */ 29 struct AbaqusInterfaceBase : public UMATInterfaceBase { 30 //! name of finite strain strategy attribute 31 static const char *const finiteStrainStrategy; 32 //! name of the orthotropy management policy attribute 33 static const char *const orthotropyManagementPolicy; 34 /*! 35 * \param[in] bd: behaviour description 36 * \param[in] fs: finite strain strategy 37 * 38 * This method is used to see if the given finite strain strategy 39 * can be used with this behaviour: 40 * - the behaviour must be strain based. 41 * - if a strain measure is defined, the finite strain strategy 42 * must match this choice. 43 */ 44 static void checkFiniteStrainStrategyDefinitionConsistency( 45 const BehaviourDescription &, const std::string &); 46 /*! 47 * \param[in] bd: behaviour description. 48 * 49 * If a strain measure and a finite strain strategy are defined, 50 * this method checks they are compatible. 51 */ 52 static void checkFiniteStrainStrategyDefinitionConsistency( 53 const BehaviourDescription &); 54 /*! 55 * \brief check if the behaviour has been associated to a strain 56 * measure or if a finite strain strategy has been defined. 57 * \param[in] bd: behaviour description. 58 */ 59 static bool hasFiniteStrainStrategy(const BehaviourDescription &); 60 /*! 61 * \brief check if the behaviour has been associated to a strain 62 * measure or if a finite strain strategy has been defined. 63 * \param[in] bd: behaviour description. 64 */ 65 static std::string getFiniteStrainStrategy(const BehaviourDescription &); 66 /*! 67 * \brief check if the orthotropy management policy defined is 68 * consistent with the behaviour. 69 * \param[in] bd: behaviour description. 70 */ 71 static void checkOrthotropyManagementPolicyConsistency( 72 const BehaviourDescription &); 73 74 static bool hasOrthotropyManagementPolicy(const BehaviourDescription &); 75 76 static std::string getOrthotropyManagementPolicy( 77 const BehaviourDescription &); 78 //! destructor 79 ~AbaqusInterfaceBase() override; 80 81 protected: 82 /*! 83 * \brief return the state variable offset used for variables used 84 * internally by the abaqus interface 85 * \param[in] mb: behaviour description 86 * \param[in] h: modelling hypothesis 87 */ 88 virtual unsigned short getStateVariablesOffset(const BehaviourDescription &, 89 const Hypothesis) const; 90 /*! 91 * \param[in,out] bd: behaviour description 92 * \param[in] k : keyword treated 93 * \param[in] p : iterator to the current token 94 * \param[in] pe : iterator past the end of the file 95 * \return a pair. The first entry is true if the keyword was 96 * treated by the interface. The second entry is an iterator after 97 * the last token treated. 98 */ 99 virtual std::pair<bool, tokens_iterator> treatCommonKeywords( 100 BehaviourDescription &, 101 const std::string &, 102 tokens_iterator, 103 const tokens_iterator); 104 /*! 105 * \return the list of supported keywords 106 */ 107 std::vector<std::string> getCommonKeywords() const; 108 /*! 109 * \return the name of the generated library 110 * \param[in] mb : behaviour description 111 */ 112 virtual std::string getLibraryName( 113 const BehaviourDescription &) const override; 114 /*! 115 * \brief write a specialisation of the AbaqusTraits class 116 * \param[in] out : ouptut file 117 * \param[in] mb : behaviour description 118 * \param[in] h : modelling hypothesis 119 */ 120 virtual void writeAbaqusBehaviourTraits(std::ostream &, 121 const BehaviourDescription &, 122 const Hypothesis) const; 123 /*! 124 * \param[in] out : output file 125 */ 126 virtual void writeMTestFileGeneratorSetModellingHypothesis( 127 std::ostream &) const override; 128 129 virtual std::string getFunctionNameBasis( 130 const std::string &) const override; 131 /*! 132 * \return the name of the function generated by the interface 133 * \param[in] n: name of the behaviour as defined by interface 134 * (generally taking into account the material 135 * and the behaviour name) 136 * \param[in] h: modelling hypothesis 137 */ 138 virtual std::string getFunctionNameForHypothesis(const std::string &, 139 const Hypothesis) const; 140 /*! 141 * \return the list of modelling hypotheses treated by the interface 142 * \param[in] mb : behaviour description 143 */ 144 virtual std::set<Hypothesis> getModellingHypothesesToBeTreated( 145 const BehaviourDescription &) const override; 146 /*! 147 * \return the input file example 148 * \param[in] mb: behaviour description 149 * \param[in] fd: file description 150 * \param[in] b: if true, write the example for 151 * Abaqus-Standard. If false, write the example for 152 * Abaqus-Explicit 153 */ 154 virtual void writeInputFileExample(const BehaviourDescription &, 155 const FileDescription &, 156 const bool) const; 157 158 virtual void writeDepvar(std::ostream &, 159 int &, 160 const Hypothesis &, 161 const VariableDescription &, 162 const std::string &) const; 163 }; // end of struct AbaqusInterfaceBase 164 165 } // end of namespace mfront 166 167 #endif /* LIB_MFRONT_ABAQUSINTERFACEBASE_HXX */ 168