1 /*! 2 * \file mfront/include/MFront/Aster/AsterInterfaceExceptions.hxx 3 * \brief 4 * \author Thomas Helfer 5 * \brief 30 janv. 2013 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_ASTER_ASTERINTERFACEEXCEPTIONS_HXX 15 #define LIB_MFRONT_ASTER_ASTERINTERFACEEXCEPTIONS_HXX 16 17 #include<string> 18 19 #include"TFEL/Exception/TFELException.hxx" 20 #include"TFEL/Material/MaterialException.hxx" 21 22 #include"MFront/Aster/Aster.hxx" 23 #include"MFront/Aster/AsterConfig.hxx" 24 #include"MFront/Aster/AsterException.hxx" 25 26 namespace aster{ 27 28 /*! 29 * This structure is called when we fall in a case that the aster 30 * interface is not able to handle. Normally, this case shall have 31 * been handled during the code generation (see the 32 * AsterInterface class). 33 */ 34 struct MFRONT_ASTER_VISIBILITY_EXPORT AsterUnSupportedCaseHandler 35 { 36 /*! 37 * \brief throw an exception 38 */ 39 TFEL_NORETURN static void 40 exe(const AsterReal *const, 41 const AsterReal *const, 42 AsterReal *const, 43 const AsterReal *const, 44 const AsterReal *const, 45 const AsterReal *const, 46 const AsterReal *const, 47 const AsterReal *const, 48 const AsterInt *const, 49 const AsterReal *const, 50 const AsterReal *const, 51 AsterReal *const, 52 const AsterInt *const, 53 AsterReal *const, 54 const StressFreeExpansionHandler&); 55 }; // end of struct AsterUnSupportedCaseHandler 56 57 /*! 58 * \class AsterInterfaceExceptions 59 * \brief Exceptions class for Aster interfaces 60 * \author Thomas Helfer 61 * \date 12/12/2011 62 */ 63 struct MFRONT_ASTER_VISIBILITY_EXPORT AsterInterfaceExceptions 64 { 65 66 /*! 67 * \brief throw an AsterException. This method shall be called when 68 * the number of materials properties declared by the beahviour and the 69 * number of materials properties declared by the interface does not 70 * match. 71 * \param[in] b : behaviour name 72 * \param[in] n1 : number of material properties declared by the behaviour 73 * \param[in] n2 : number of material properties declared by the interface 74 */ 75 TFEL_NORETURN static void 76 throwUnMatchedNumberOfMaterialProperties(const std::string&, 77 const unsigned short n1, 78 const AsterInt n2); 79 80 /*! 81 * \brief throw an AsterException. This method shall be called when 82 * the number of state variables declared by the beahviour and the 83 * number of state variables declared by the interface does not 84 * match. 85 * \param[in] b : behaviour name 86 * \param[in] n1 : number of state variables declared by the behaviour 87 * \param[in] n2 : number of state variables declared by the interface 88 */ 89 TFEL_NORETURN static void 90 throwUnMatchedNumberOfStateVariables(const std::string&, 91 const unsigned short n1, 92 const AsterInt n2); 93 94 /*! 95 * \brief display the error message out of an AsterException to the 96 * standard output. 97 * \param[in] b : behaviour name 98 * \param[in] e : the AsterException to be treated 99 */ 100 static void 101 treatAsterException(const std::string&, 102 const AsterException&); 103 /*! 104 * \brief display the error message out of a material exception to the 105 * standard output. 106 * \param[in] b : behaviour name 107 * \param[in] e : the material exception to be treated 108 */ 109 static void 110 treatMaterialException(const std::string&, 111 const tfel::material::MaterialException&); 112 /*! 113 * \brief display the error message out of a generic tfel 114 * exception to the standard output. 115 * \param[in] b : behaviour name 116 * \param[in] e : the exception to be treated 117 */ 118 static void 119 treatTFELException(const std::string&, 120 const tfel::exception::TFELException&); 121 /*! 122 * \brief display the error message out of a generic standard 123 * exception to the standard output. 124 * \param[in] b : behaviour name 125 * \param[in] e : the exception to be treated 126 */ 127 static void 128 treatStandardException(const std::string&, 129 const std::exception&); 130 /*! 131 * \brief display the error message when an unknown exception is caught 132 * \param[in] b : behaviour name 133 */ 134 static void 135 treatUnknownException(const std::string&); 136 /*! 137 * \brief throw an AsterException if the time step is negative 138 * \param[in] b : behaviour name 139 */ 140 TFEL_NORETURN static void 141 throwNegativeTimeStepException(const std::string&); 142 /*! 143 * \brief throw an AsterException if the DDSOE parameter is invalid 144 * \param[in] b : behaviour name 145 * \param[in] v : DDSOE value 146 */ 147 TFEL_NORETURN static void 148 throwInvalidDDSOEException(const std::string&, 149 const AsterReal); 150 /*! 151 * \brief throw an AsterException if the prediction computation 152 * failed 153 * \param[in] b : behaviour name 154 */ 155 TFEL_NORETURN static void 156 throwPredictionComputationFailedException(const std::string&); 157 /*! 158 * \brief throw an AsterException if the behaviour integration 159 * failed 160 * \param[in] b : behaviour name 161 */ 162 TFEL_NORETURN static void 163 throwBehaviourIntegrationFailedException(const std::string&); 164 /*! 165 * \brief throw an AsterException if the a consistent tangent 166 * operator has to been requested and that the behaviour does not 167 * provide one. 168 * \param[in] b : behaviour name 169 */ 170 TFEL_NORETURN static void 171 throwConsistentTangentOperatorIsNotAvalaible(const std::string&); 172 /*! 173 * \brief throw an AsterException if the a prediction operator has 174 * to been requested and that the behaviour does not provide one. 175 * \param[in] b : behaviour name 176 */ 177 TFEL_NORETURN static void 178 throwPredictionOperatorIsNotAvalaible(const std::string&); 179 /*! 180 * \brief display an error message if the behaviour shall handle 181 * stress free expansion and that the umat interface can't 182 * \param[in] b : behaviour name 183 */ 184 TFEL_NORETURN static void 185 throwUnsupportedStressFreeExpansionException(const std::string&); 186 /*! 187 * \brief display an error message if the value of the NTENS 188 * parameter is not valid 189 */ 190 static void 191 displayUnsupportedHypothesisMessage(); 192 193 }; // end of struct AsterInterfaceExceptions 194 195 /*! 196 * \brief an helper class used to reduce the tangent operator from 197 * 3D to a lower dimension 198 */ 199 template<unsigned short N> 200 struct AsterReduceTangentOperator; 201 202 template<> 203 struct MFRONT_ASTER_VISIBILITY_EXPORT AsterReduceTangentOperator<1u> 204 { 205 static void 206 exe(AsterReal * const, 207 const AsterReal* const); 208 }; 209 210 template<> 211 struct MFRONT_ASTER_VISIBILITY_EXPORT AsterReduceTangentOperator<2u> 212 { 213 static void 214 exe(AsterReal * const, 215 const AsterReal* const); 216 }; 217 218 } // end of namespace aster 219 220 #endif /* LIB_MFRONT_ASTER_ASTERINTERFACEEXCEPTIONS_HXX */ 221 222