1 /*! 2 * \file mfront/include/MFront/Castem/CastemInterfaceExceptions.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_CASTEM_CASTEMINTERFACEEXCEPTIONS_HXX 15 #define LIB_MFRONT_CASTEM_CASTEMINTERFACEEXCEPTIONS_HXX 16 17 #include<string> 18 19 #include"TFEL/Exception/TFELException.hxx" 20 #include"TFEL/Material/MaterialException.hxx" 21 22 #include"MFront/Castem/Castem.hxx" 23 #include"MFront/Castem/CastemTraits.hxx" 24 #include"MFront/Castem/CastemConfig.hxx" 25 #include"MFront/Castem/CastemException.hxx" 26 27 namespace castem{ 28 29 /*! 30 * This structure is called when we fall in a case that the castem 31 * interface is not able to handle. Normally, this case shall have 32 * been handled during the code generation (see the 33 * CastemInterface class). 34 */ 35 struct MFRONT_CASTEM_VISIBILITY_EXPORT CastemUnSupportedCaseHandler 36 { 37 /*! 38 * \brief throw an exception 39 */ 40 TFEL_NORETURN static void 41 exe(const CastemReal *const, 42 const CastemReal *const, 43 CastemReal *const, 44 const CastemReal *const, 45 const CastemReal *const, 46 const CastemReal *const, 47 const CastemReal *const, 48 const CastemReal *const, 49 const CastemInt *const, 50 const CastemReal *const, 51 const CastemReal *const, 52 CastemReal *const, 53 const CastemInt *const, 54 CastemReal *const, 55 const StressFreeExpansionHandler&); 56 }; // end of struct CastemUnSupportedCaseHandler 57 58 /*! 59 * \class CastemInterfaceExceptions 60 * \brief Base class for castem interfaces 61 * \author Thomas Helfer 62 * \date 12/12/2011 63 */ 64 struct MFRONT_CASTEM_VISIBILITY_EXPORT CastemInterfaceExceptions 65 { 66 /*! 67 * \brief throw an CastemException. 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 CastemInt n2); 79 80 /*! 81 * \brief throw an CastemException. 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 CastemInt n2); 93 94 /*! 95 * \brief display the error message out of an CastemException to the 96 * standard output. 97 * \param[in] b : behaviour name 98 * \param[in] e : the CastemException to be treated 99 */ 100 static void 101 treatCastemException(const std::string&, 102 const CastemException&); 103 104 /*! 105 * \brief display the error message out of a material exception to the 106 * standard output. 107 * \param[in] b : behaviour name 108 * \param[in] e : the material exception to be treated 109 */ 110 static void 111 treatMaterialException(const std::string&, 112 const tfel::material::MaterialException&); 113 114 /*! 115 * \brief display the error message out of a generic tfel 116 * exception to the standard output. 117 * \param[in] b : behaviour name 118 * \param[in] e : the exception to be treated 119 */ 120 static void 121 treatTFELException(const std::string&, 122 const tfel::exception::TFELException&); 123 124 /*! 125 * \brief display the error message out of a generic standard 126 * exception to the standard output. 127 * \param[in] b : behaviour name 128 * \param[in] e : the exception to be treated 129 */ 130 static void 131 treatStandardException(const std::string&, 132 const std::exception&); 133 134 /*! 135 * \brief display the error message when an unknown exception is caught 136 * \param[in] b : behaviour name 137 */ 138 static void 139 treatUnknownException(const std::string&); 140 141 /*! 142 * \brief throw an CastemException if the time step is negative 143 * \param[in] b : behaviour name 144 */ 145 TFEL_NORETURN static void 146 throwNegativeTimeStepException(const std::string&); 147 148 /*! 149 * \brief throw an CastemException if the behaviour integration 150 * failed 151 * \param[in] b : behaviour name 152 */ 153 TFEL_NORETURN static void 154 throwBehaviourIntegrationFailedException(const std::string&); 155 156 /*! 157 * \brief throw an CastemException if the maximum number of sub 158 * stepping has been reached 159 * \param[in] b : behaviour name 160 */ 161 TFEL_NORETURN static void 162 throwMaximumNumberOfSubSteppingReachedException(const std::string&); 163 164 /*! 165 * \brief throw an CastemException if the maximum number of sub 166 * stepping has been reached 167 * \param[in] b : behaviour name 168 */ 169 TFEL_NORETURN static void 170 throwPlaneStressMaximumNumberOfIterationsReachedException(const std::string&); 171 /*! 172 * \brief throw an CastemException if the DDSDDE parameter is invalid 173 * \param[in] b : behaviour name 174 * \param[in] v : DDSDDE value 175 */ 176 TFEL_NORETURN static void 177 throwInvalidDDSDDEException(const std::string&, 178 const CastemReal); 179 /*! 180 * \brief throw an CastemException when a tanget operator is 181 * requested in the generic plane stress handler 182 * \param[in] b : behaviour name 183 */ 184 TFEL_NORETURN static void 185 throwTangentOperatorNotAvailableThroughGenericPlaneStressHandler(const std::string&); 186 /*! 187 * \brief throw an AsterException if the prediction computation 188 * failed 189 * \param[in] b : behaviour name 190 */ 191 TFEL_NORETURN static void 192 throwPredictionComputationFailedException(const std::string&); 193 /*! 194 * \brief throw an AsterException if the a consistent tangent 195 * operator has to been requested and that the behaviour does not 196 * provide one. 197 * \param[in] b : behaviour name 198 */ 199 TFEL_NORETURN static void 200 throwConsistentTangentOperatorIsNotAvalaible(const std::string&); 201 /*! 202 * \brief throw an AsterException if the a prediction operator has 203 * to been requested and that the behaviour does not provide one. 204 * \param[in] b : behaviour name 205 */ 206 TFEL_NORETURN static void 207 throwPredictionOperatorIsNotAvalaible(const std::string&); 208 /*! 209 * \brief throw an error message if the value of the NTENS 210 * parameter is not valid 211 * \param[in] NTENS : NTENS value 212 * \param[in] s : expected size 213 */ 214 static void 215 checkNTENSValue(const CastemInt,const unsigned short); 216 /*! 217 * \brief throw an error message if the behaviour type is not supported for the given hypothesis 218 * \param[in] type : behaviour type 219 * \param[in] H : hypothesis 220 */ 221 TFEL_NORETURN static void 222 throwInvalidBehaviourTypeAndModellingHypothesis(const CastemBehaviourType, 223 const std::string&); 224 /*! 225 * \brief display an error message if the behaviour shall handle 226 * stress free expansion and that the castem interface can't 227 * \param[in] b : behaviour name 228 */ 229 TFEL_NORETURN static void 230 throwUnsupportedStressFreeExpansionException(const std::string&); 231 /*! 232 * \brief display an error message if the thermal expansion is not 233 * null 234 * \param[in] b : behaviour name 235 */ 236 TFEL_NORETURN static void 237 throwThermalExpansionCoefficientShallBeNull(const std::string&); 238 /*! 239 * \brief display an error message if the value of the NDI 240 * parameter is not valid 241 */ 242 static void 243 displayInvalidModellingHypothesisErrorMessage(); 244 245 }; // end of struct CastemInterfaceExceptions 246 247 } // end of namespace castem 248 249 #endif /* LIB_MFRONT_CASTEM_CASTEMINTERFACEEXCEPTIONS_HXX */ 250 251