135 class gsXml< gsMaterialMatrixBase<T> >
139 typedef gsMaterialMatrixBase<T> Object;
142 GSXML_COMMON_FUNCTIONS(Object);
143 static std::string tag () {
return "MaterialMatrix"; }
144 static std::string type () {
return ""; }
148 static void get_into(gsXmlNode * node, Object & obj)
154 static Object *
get(gsXmlNode * node)
156 GISMO_ASSERT( ( !strcmp( node->name(),
"MaterialMatrix") ),
157 "Something went wrong, was waiting for a MaterialMatrix tag.\n" );
159 gsXmlAttribute * gtype = node->first_attribute(
"type");
162 gsWarn<<
"MaterialMatrix without a type in the xml file\n";
166 const gsXmlAttribute * att_TFT = node->first_attribute(
"TFT");
170 if ((strcmp(
"1", att_TFT->value()) == 0) ||
171 (strcmp(
"true", att_TFT->value()) == 0) ||
172 (strcmp(
"True", att_TFT->value()) == 0) )
176 std::string s = gtype->value() ;
177 Object * tmp = get_impl(node);
180 if ( ( s ==
"Linear2" ) )
181 return new gsMaterialMatrixTFT<2,T,true>(tmp);
182 else if ( ( s ==
"Linear3" ) )
183 return new gsMaterialMatrixTFT<3,T,true>(tmp);
184 else if ( ( s ==
"CompressibleNH2" ) ||
185 ( s ==
"IncompressibleNH2" ) ||
186 ( s ==
"CompressibleNHe2" ) ||
187 ( s ==
"IncompressibleNHe2" ) ||
188 ( s ==
"CompressibleMR2" ) ||
189 ( s ==
"IncompressibleMR2" ) ||
190 ( s ==
"CompressibleOG2" ) ||
191 ( s ==
"IncompressibleOG2" ) )
192 return new gsMaterialMatrixTFT<2,T,false>(tmp);
193 else if ( ( s ==
"CompressibleNH3" ) ||
194 ( s ==
"IncompressibleNH3" ) ||
195 ( s ==
"CompressibleNHe3" ) ||
196 ( s ==
"IncompressibleNHe3" ) ||
197 ( s ==
"CompressibleMR3" ) ||
198 ( s ==
"IncompressibleMR3" ) ||
199 ( s ==
"CompressibleOG3" ) ||
200 ( s ==
"IncompressibleOG3" ) )
201 return new gsMaterialMatrixTFT<3,T,false>(tmp);
204 gsWarn<<
"Material matrix for TFT model not recognised\n";
212 static Object * get_impl(gsXmlNode * node)
214 GISMO_ASSERT( ( !strcmp( node->name(),
"MaterialMatrix") ),
215 "Something went wrong, was waiting for a MaterialMatrix tag.\n" );
217 gsXmlAttribute * gtype = node->first_attribute(
"type");
220 gsWarn<<
"MaterialMatrix without a type in the xml file\n";
224 std::string s = gtype->value() ;
225 if ( s ==
"Linear2" )
226 return gsXml< gsMaterialMatrixLinear<2,T> >::get(node);
227 if ( s ==
"Linear3" )
228 return gsXml< gsMaterialMatrixLinear<3,T> >::get(node);
230 if ( s ==
"CompressibleNH2" )
231 return gsXml< gsMaterialMatrixNonlinear<2,T,11,true> >::get(node);
232 if ( s ==
"CompressibleNH3" )
233 return gsXml< gsMaterialMatrixNonlinear<3,T,11,true> >::get(node);
234 if ( s ==
"IncompressibleNH2" )
235 return gsXml< gsMaterialMatrixNonlinear<2,T,11,false> >::get(node);
236 if ( s ==
"IncompressibleNH3" )
237 return gsXml< gsMaterialMatrixNonlinear<3,T,11,false> >::get(node);
239 if ( s ==
"CompressibleNHe2" )
240 return gsXml< gsMaterialMatrixNonlinear<2,T,12,true> >::get(node);
241 if ( s ==
"CompressibleNHe3" )
242 return gsXml< gsMaterialMatrixNonlinear<3,T,12,true> >::get(node);
243 if ( s ==
"IncompressibleNHe2" )
244 return gsXml< gsMaterialMatrixNonlinear<2,T,12,false> >::get(node);
245 if ( s ==
"IncompressibleNHe3" )
246 return gsXml< gsMaterialMatrixNonlinear<3,T,12,false> >::get(node);
248 if ( s ==
"CompressibleMR2" )
249 return gsXml< gsMaterialMatrixNonlinear<2,T,13,true> >::get(node);
250 if ( s ==
"CompressibleMR3" )
251 return gsXml< gsMaterialMatrixNonlinear<3,T,13,true> >::get(node);
252 if ( s ==
"IncompressibleMR2" )
253 return gsXml< gsMaterialMatrixNonlinear<2,T,13,false> >::get(node);
254 if ( s ==
"IncompressibleMR3" )
255 return gsXml< gsMaterialMatrixNonlinear<3,T,13,false> >::get(node);
257 if ( s ==
"CompressibleOG2" )
258 return gsXml< gsMaterialMatrixNonlinear<2,T,34,true> >::get(node);
259 if ( s ==
"CompressibleOG3" )
260 return gsXml< gsMaterialMatrixNonlinear<3,T,34,true> >::get(node);
261 if ( s ==
"IncompressibleOG2" )
262 return gsXml< gsMaterialMatrixNonlinear<2,T,34,false> >::get(node);
263 if ( s ==
"IncompressibleOG3" )
264 return gsXml< gsMaterialMatrixNonlinear<3,T,34,false> >::get(node);
266 gsWarn<<
"gsMaterialMatrixBase: get<MaterialMatrixBase<T>>: No known MaterialMatrix \""<<s<<
"\". Error.\n";
270 static gsXmlNode * put (
const Object & obj,
273 const Object * ptr = & obj;
274 if (
dynamic_cast<const gsMaterialMatrixTFT<2,T,true> *
>( ptr )
276 dynamic_cast<const gsMaterialMatrixTFT<3,T,true> *
>( ptr )
278 dynamic_cast<const gsMaterialMatrixTFT<2,T,false> *
>( ptr )
280 dynamic_cast<const gsMaterialMatrixTFT<3,T,false> *
>( ptr )
283 gsXmlNode * tmp = put_impl(ptr->material(),data);
288 return put_impl(ptr,data);
291 static gsXmlNode * put_impl (
const Object * obj,
294 if (
const gsMaterialMatrixLinear<2,T> * mm =
295 dynamic_cast<const gsMaterialMatrixLinear<2,T> *
>( obj ) )
296 return gsXml< gsMaterialMatrixLinear<2,T> >::put(*mm,data);
297 if (
const gsMaterialMatrixLinear<3,T> * mm =
298 dynamic_cast<const gsMaterialMatrixLinear<3,T> *
>( obj ) )
299 return gsXml< gsMaterialMatrixLinear<3,T> >::put(*mm,data);
302 if (
const gsMaterialMatrixNonlinear<2,T,11,true> * mm =
303 dynamic_cast<const gsMaterialMatrixNonlinear<2,T,11,true> *
>( obj ) )
304 return gsXml< gsMaterialMatrixNonlinear<2,T,11,true> >::put(*mm,data);
306 if (
const gsMaterialMatrixNonlinear<3,T,11,true> * mm =
307 dynamic_cast<const gsMaterialMatrixNonlinear<3,T,11,true> *
>( obj ) )
308 return gsXml< gsMaterialMatrixNonlinear<3,T,11,true> >::put(*mm,data);
310 if (
const gsMaterialMatrixNonlinear<2,T,11,false> * mm =
311 dynamic_cast<const gsMaterialMatrixNonlinear<2,T,11,false> *
>( obj ) )
312 return gsXml< gsMaterialMatrixNonlinear<2,T,11,false> >::put(*mm,data);
314 if (
const gsMaterialMatrixNonlinear<3,T,11,false> * mm =
315 dynamic_cast<const gsMaterialMatrixNonlinear<3,T,11,false> *
>( obj ) )
316 return gsXml< gsMaterialMatrixNonlinear<3,T,11,false> >::put(*mm,data);
319 if (
const gsMaterialMatrixNonlinear<2,T,12,true> * mm =
320 dynamic_cast<const gsMaterialMatrixNonlinear<2,T,12,true> *
>( obj ) )
321 return gsXml< gsMaterialMatrixNonlinear<2,T,12,true> >::put(*mm,data);
323 if (
const gsMaterialMatrixNonlinear<3,T,12,true> * mm =
324 dynamic_cast<const gsMaterialMatrixNonlinear<3,T,12,true> *
>( obj ) )
325 return gsXml< gsMaterialMatrixNonlinear<3,T,12,true> >::put(*mm,data);
327 if (
const gsMaterialMatrixNonlinear<2,T,12,false> * mm =
328 dynamic_cast<const gsMaterialMatrixNonlinear<2,T,12,false> *
>( obj ) )
329 return gsXml< gsMaterialMatrixNonlinear<2,T,12,false> >::put(*mm,data);
331 if (
const gsMaterialMatrixNonlinear<3,T,12,false> * mm =
332 dynamic_cast<const gsMaterialMatrixNonlinear<3,T,12,false> *
>( obj ) )
333 return gsXml< gsMaterialMatrixNonlinear<3,T,12,false> >::put(*mm,data);
336 if (
const gsMaterialMatrixNonlinear<2,T,13,true> * mm =
337 dynamic_cast<const gsMaterialMatrixNonlinear<2,T,13,true> *
>( obj ) )
338 return gsXml< gsMaterialMatrixNonlinear<2,T,13,true> >::put(*mm,data);
340 if (
const gsMaterialMatrixNonlinear<3,T,13,true> * mm =
341 dynamic_cast<const gsMaterialMatrixNonlinear<3,T,13,true> *
>( obj ) )
342 return gsXml< gsMaterialMatrixNonlinear<3,T,13,true> >::put(*mm,data);
344 if (
const gsMaterialMatrixNonlinear<2,T,13,false> * mm =
345 dynamic_cast<const gsMaterialMatrixNonlinear<2,T,13,false> *
>( obj ) )
346 return gsXml< gsMaterialMatrixNonlinear<2,T,13,false> >::put(*mm,data);
348 if (
const gsMaterialMatrixNonlinear<3,T,13,false> * mm =
349 dynamic_cast<const gsMaterialMatrixNonlinear<3,T,13,false> *
>( obj ) )
350 return gsXml< gsMaterialMatrixNonlinear<3,T,13,false> >::put(*mm,data);
353 if (
const gsMaterialMatrixNonlinear<2,T,34,true> * mm =
354 dynamic_cast<const gsMaterialMatrixNonlinear<2,T,34,true> *
>( obj ) )
355 return gsXml< gsMaterialMatrixNonlinear<2,T,34,true> >::put(*mm,data);
357 if (
const gsMaterialMatrixNonlinear<3,T,34,true> * mm =
358 dynamic_cast<const gsMaterialMatrixNonlinear<3,T,34,true> *
>( obj ) )
359 return gsXml< gsMaterialMatrixNonlinear<3,T,34,true> >::put(*mm,data);
361 if (
const gsMaterialMatrixNonlinear<2,T,34,false> * mm =
362 dynamic_cast<const gsMaterialMatrixNonlinear<2,T,34,false> *
>( obj ) )
363 return gsXml< gsMaterialMatrixNonlinear<2,T,34,false> >::put(*mm,data);
365 if (
const gsMaterialMatrixNonlinear<3,T,34,false> * mm =
366 dynamic_cast<const gsMaterialMatrixNonlinear<3,T,34,false> *
>( obj ) )
367 return gsXml< gsMaterialMatrixNonlinear<3,T,34,false> >::put(*mm,data);
369 gsWarn<<
"gsMaterialMatrixBase: put<MaterialMatrixBase<T>>: No known MaterialMatrix "<< obj <<
"Error.\n";
Provides linear material matrices.
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
#define gsWarn
Definition: gsDebug.h:50
gsXmlAttribute * makeAttribute(const std::string &name, const std::string &value, gsXmlTree &data)
Helper to allocate XML attribute.
Definition: gsXml.cpp:37
Provides linear material matrices.
Provides hyperelastic material matrices.
Provides a base class for material matrices.