1 /*!
2  * \file  mfront/include/MFront/Abaqus/AbaqusInterfaceExceptions.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_ABAQUS_ABAQUSINTERFACEEXCEPTIONS_HXX
15 #define LIB_MFRONT_ABAQUS_ABAQUSINTERFACEEXCEPTIONS_HXX
16 
17 #include<string>
18 
19 #include"TFEL/Exception/TFELException.hxx"
20 #include"TFEL/Material/MaterialException.hxx"
21 
22 #include"MFront/Abaqus/Abaqus.hxx"
23 #include"MFront/Abaqus/AbaqusConfig.hxx"
24 #include"MFront/Abaqus/AbaqusException.hxx"
25 
26 namespace abaqus{
27 
28   /*!
29    * This structure is called when we fall in a case that the abaqus
30    * interface is not able to handle. Normally, this case shall have
31    * been handled during the code generation (see the
32    * AbaqusInterface class).
33    */
34   struct MFRONT_ABAQUS_VISIBILITY_EXPORT AbaqusUnSupportedCaseHandler
35   {
36     /*!
37      * \brief throw an exception
38      */
39     TFEL_NORETURN static void
40     exe(const AbaqusReal *const,
41 	const AbaqusReal *const,
42 	AbaqusReal *const,
43 	const AbaqusReal *const,
44 	const AbaqusReal *const,
45 	const AbaqusReal *const,
46 	const AbaqusReal *const,
47 	const AbaqusReal *const,
48 	const AbaqusInt  *const,
49 	const AbaqusReal *const,
50 	const AbaqusReal *const,
51 	AbaqusReal *const,
52 	const AbaqusInt  *const,
53 	AbaqusReal *const,
54 	const StressFreeExpansionHandler<AbaqusReal>&);
55   }; // end of struct AbaqusUnSupportedCaseHandler
56 
57   /*!
58    * \class  AbaqusInterfaceExceptions
59    * \brief  Exceptions class for Abaqus interfaces
60    * \author Thomas Helfer
61    * \date   12/12/2011
62    */
63   struct MFRONT_ABAQUS_VISIBILITY_EXPORT AbaqusInterfaceExceptions
64   {
65     /*!
66      * \brief throw an AbaqusException. This method shall be called
67      * when the number of components of symmetric tensors for the
68      * current hypothesis does not match the the number of components
69      * of symmetric tensors given by `Abaqus/Standard`
70      * \param[in] b  : behaviour name
71      * \param[in] n1 : size of symmetric tensors for the current hypothesis
72      * \param[in] n2 : size of symmetric tensors declared by the `Abaqus/Standard`
73      */
74     TFEL_NORETURN static void
75     throwInvalidTensorSize(const std::string&,
76 			   const unsigned short n1,
77 			   const AbaqusInt n2);
78     /*!
79      * \brief throw an AbaqusException. This method shall be called when
80      * the number of materials properties declared by the behaviour and the
81      * number of  materials properties declared by the interface does not
82      * match.
83      * \param[in] b  : behaviour name
84      * \param[in] n1 : number of material properties declared by the behaviour
85      * \param[in] n2 : number of material properties declared by the interface
86      */
87     TFEL_NORETURN static void
88     throwUnMatchedNumberOfMaterialProperties(const std::string&,
89 					     const unsigned short n1,
90 					     const AbaqusInt n2);
91     /*!
92      * \brief throw an AbaqusException. This method shall be called when
93      * the number of state variables declared by the behaviour and the
94      * number of state variables declared by the interface does not
95      * match.
96      * \param[in] b  : behaviour name
97      * \param[in] n1 : number of state variables declared by the behaviour
98      * \param[in] n2 : number of state variables declared by the interface
99      */
100     TFEL_NORETURN static void
101     throwUnMatchedNumberOfStateVariables(const std::string&,
102 					 const unsigned short n1,
103 					 const AbaqusInt n2);
104 
105     /*!
106      * \brief display the error message out of an AbaqusException to the
107      * standard output.
108      * \param[in] b : behaviour name
109      * \param[in] e : the AbaqusException to be treated
110      */
111     static void
112     treatAbaqusException(const std::string&,
113 			const AbaqusException&);
114     /*!
115      * \brief display the error message out of a material exception to the
116      * standard output.
117      * \param[in] b : behaviour name
118      * \param[in] e : the material exception to be treated
119      */
120     static void
121     treatMaterialException(const std::string&,
122 			   const tfel::material::MaterialException&);
123     /*!
124      * \brief display the error message out of a generic tfel
125      * exception to the standard output.
126      * \param[in] b : behaviour name
127      * \param[in] e : the exception to be treated
128      */
129     static void
130     treatTFELException(const std::string&,
131 		       const tfel::exception::TFELException&);
132     /*!
133      * \brief display the error message out of a generic standard
134      * exception to the standard output.
135      * \param[in] b : behaviour name
136      * \param[in] e : the exception to be treated
137      */
138     static void
139     treatStandardException(const std::string&,
140 			   const std::exception&);
141     /*!
142      * \brief display the error message when an unknown exception is caught
143      * \param[in] b : behaviour name
144      */
145     static void
146     treatUnknownException(const std::string&);
147     /*!
148      * \brief throw an AbaqusException if the time step is negative
149      * \param[in] b : behaviour name
150      */
151     TFEL_NORETURN static void
152     throwNegativeTimeStepException(const std::string&);
153     /*!
154      * \brief throw an AbaqusException if the prediction computation
155      * failed
156      * \param[in] b : behaviour name
157      */
158     TFEL_NORETURN static void
159     throwPredictionComputationFailedException(const std::string&);
160     /*!
161      * \brief throw an AbaqusException if the a consistent tangent
162      * operator has to been requested and that the behaviour does not
163      * provide one.
164      * \param[in] b : behaviour name
165      */
166     TFEL_NORETURN static void
167     throwConsistentTangentOperatorIsNotAvalaible(const std::string&);
168     /*!
169      * \brief throw an AbaqusException if the a prediction operator has
170      * to been requested and that the behaviour does not provide one.
171      * \param[in] b : behaviour name
172      */
173     TFEL_NORETURN static void
174     throwPredictionOperatorIsNotAvalaible(const std::string&);
175     /*!
176      * \brief display an error message if the behaviour shall handle
177      * stress free expansion and that the umat interface can't
178      * \param[in] b : behaviour name
179      */
180     TFEL_NORETURN static void
181     throwUnsupportedStressFreeExpansionException(const std::string&);
182     /*!
183      * \brief display an error message if the value of the NTENS
184      * parameter is not valid
185      */
186     static void
187     displayUnsupportedHypothesisMessage();
188 
189   }; // end of struct AbaqusInterfaceExceptions
190 
191 } // end of namespace abaqus
192 
193 #endif /* LIB_MFRONT_ABAQUS_ABAQUSINTERFACEEXCEPTIONS_HXX */
194 
195