1 /*! 2 * \file mfront/src/AbaqusInterfaceExceptions.cxx 3 * \brief This file implements the AbaqusInterfaceExceptions class. 4 * \author Thomas Helfer 5 * \date 12/12/2011 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 #include<cstdlib> 15 #include<sstream> 16 #include<iostream> 17 18 #include"TFEL/Raise.hxx" 19 #include"MFront/Abaqus/AbaqusInterfaceExceptions.hxx" 20 21 namespace abaqus{ 22 23 void 24 AbaqusInterfaceExceptions::throwInvalidTensorSize(const std::string& b, 25 const unsigned short n1, 26 const AbaqusInt n2) 27 { 28 std::ostringstream msg; 29 msg << "AbaqusInterfaceExceptions::throwInvalidTensorSize: " 30 << "the size of symmetric tensors for the current hypothesis does not match " 31 << "`Abaqus` declaration (NTENS) for behaviour '" << b << "'. Expected '" 32 << n1 << "', got '" << n2 << "'."; 33 tfel::raise<AbaqusException>(msg.str()); 34 } // end AbaqusInterfaceExceptions::throwInvalidTensorSize 35 36 void 37 AbaqusInterfaceExceptions::throwUnMatchedNumberOfMaterialProperties(const std::string& b, 38 const unsigned short n1, 39 const AbaqusInt n2) 40 { 41 std::ostringstream msg; 42 msg << "AbaqusInterfaceExceptions::throwUnMatchedNumberOfMaterialProperties: " 43 << "the number of material properties does not match. The behaviour '" 44 << b << "' requires " << n1 << " material properties, and " 45 << n2 << " material properties were declared"; 46 tfel::raise<AbaqusException>(msg.str()); 47 } // end of throwUnMatchedNumberOfMaterialProperties 48 49 void 50 AbaqusInterfaceExceptions::throwUnMatchedNumberOfStateVariables(const std::string& b, 51 const unsigned short n1, 52 const AbaqusInt n2) 53 { 54 std::ostringstream msg; 55 msg << "AbaqusInterfaceExceptions::throwUnMatchedNumberOfStateVariables: " 56 << "the number of internal state variables does not match. The behaviour '" 57 << b << "' requires " << n1 << " state variables, and " 58 << n2 << " state variables were declared"; 59 tfel::raise<AbaqusException>(msg.str()); 60 } // end of throwUnMatchedNumberOfStateVariables 61 62 void 63 AbaqusInterfaceExceptions::treatAbaqusException(const std::string& b, 64 const AbaqusException& e) 65 { 66 std::cout << "The behaviour '" << b 67 << "' has thrown an AbaqusException: " 68 << e.what() << std::endl; 69 } // end of AbaqusInterfaceExceptions::treatAbaqusException 70 71 void 72 AbaqusInterfaceExceptions::treatMaterialException(const std::string& b, 73 const tfel::material::MaterialException& e) 74 { 75 std::cout << "The behaviour '" << b 76 << "' has thrown an MaterialException: " 77 << e.what() << std::endl; 78 } // end of treatMaterialException 79 80 void 81 AbaqusInterfaceExceptions::treatTFELException(const std::string& b, 82 const tfel::exception::TFELException& e) 83 { 84 std::cout << "The behaviour '" << b 85 << "' has thrown a generic tfel exception: " 86 << e.what() << std::endl; 87 } // end of treatTFELException 88 89 void 90 AbaqusInterfaceExceptions::treatStandardException(const std::string& b, 91 const std::exception& e) 92 { 93 std::cout << "The behaviour '" << b 94 << "' has thrown a generic standard exception: " 95 << e.what() << std::endl; 96 } // end of treatStandardException 97 98 void 99 AbaqusInterfaceExceptions::treatUnknownException(const std::string& b) 100 { 101 std::cout << "The behaviour '" << b 102 << "' has thrown an unknown exception" << std::endl; 103 } // end of treatUnknownException 104 105 void 106 AbaqusInterfaceExceptions::throwNegativeTimeStepException(const std::string& b) 107 { 108 tfel::raise("AbaqusInterfaceExceptions::throwNegativeTimeStepException: " 109 "negative time step detected for behaviour '"+b+"'"); 110 } // end of AbaqusInterfaceExceptions::throwNegativeTimeStepException 111 112 void 113 AbaqusInterfaceExceptions::throwPredictionComputationFailedException(const std::string& b) 114 { 115 tfel::raise("AbaqusInterfaceExceptions::throwPredictionComputationFailedException: " 116 "prediction computation failed for behaviour '"+b+"'"); 117 } 118 119 void 120 AbaqusInterfaceExceptions::throwPredictionOperatorIsNotAvalaible(const std::string& b) 121 { 122 tfel::raise("AbaqusInterfaceExceptions::throwPredictionOperatorIsNotAvalaible: " 123 "behaviour '"+b+"' can't compute a prediction operator"); 124 } // end of AbaqusInterfaceExceptions::throwBehaviourIntegrationFailedException 125 126 void 127 AbaqusInterfaceExceptions::throwConsistentTangentOperatorIsNotAvalaible(const std::string& b) 128 { 129 tfel::raise("AbaqusInterfaceExceptions::throwConsistentTangentOperatorIsNotAvalaible: " 130 "behaviour '"+b+"' can't compute a consistent tangent operator"); 131 } // end of AbaqusInterfaceExceptions::throwBehaviourIntegrationFailedException 132 133 void 134 AbaqusInterfaceExceptions::throwUnsupportedStressFreeExpansionException(const std::string& b) 135 { 136 tfel::raise("AbaqusInterfaceExceptions::throwUnsupportedStressFreeExpansionException: " 137 "behaviour '"+b+"' can handle stress-free expansion but the Abaqus interface can't"); 138 } // end of AbaqusInterfaceExceptions::throwUnsupportedStressFreeExpansionException 139 140 void 141 AbaqusInterfaceExceptions::displayUnsupportedHypothesisMessage() 142 { 143 std::cout << "AbaqusInterfaceExceptions::displayUnsupportedHypothesisMessage: " 144 << "unsupported hypothesis" << std::endl; 145 } 146 147 void 148 AbaqusUnSupportedCaseHandler::exe(const AbaqusReal *const, 149 const AbaqusReal *const, 150 AbaqusReal *const, 151 const AbaqusReal *const, 152 const AbaqusReal *const, 153 const AbaqusReal *const, 154 const AbaqusReal *const, 155 const AbaqusReal *const, 156 const AbaqusInt *const, 157 const AbaqusReal *const, 158 const AbaqusReal *const, 159 AbaqusReal *const, 160 const AbaqusInt *const, 161 AbaqusReal *const, 162 const StressFreeExpansionHandler<AbaqusReal>&) 163 { 164 tfel::raise("AbaqusUnSupportedCaseHandler::exe: " 165 "we fall in a case that the abaqus interface " 166 "is not able to handle."); 167 } // end of exe 168 169 } // end of namespace abaqus 170