24 template<
class Object>
25 Object getMaterialMatrixFromXml ( gsXmlNode * node)
27 typedef typename Object::Scalar_t T;
30 assert ( ( !strcmp( node->name(),
"MaterialMatrix") ) &&
31 ( !strcmp(node->first_attribute(
"type")->value(), gsXml<Object>::type().c_str() ) ) );
33 Object result = Object();
37 tmp = node->first_node(
"Thickness");
39 gsFunctionExpr<T> thickness;
40 gsXml<gsFunctionExpr<T> >::get_into(tmp->first_node(
"Function"), thickness);
41 result.setThickness(thickness);
43 tmp = node->first_node(
"Density");
44 gsFunctionExpr<T> density;
45 bool hasDensity = tmp;
48 gsXml<gsFunctionExpr<T> >::get_into(tmp->first_node(
"Function"), density);
49 result.setDensity(density);
52 gsXmlNode * parNode = node->first_node(
"Parameters");
54 gsFunctionExpr<T> fun;
55 for (gsXmlNode * child = parNode->first_node(
"Function"); child; child =
56 child->next_sibling(
"Function"))
58 const int i = atoi(child->first_attribute(
"index")->value());
59 gsXml<gsFunctionExpr<T> >::get_into(child, fun);
60 result.setParameter(i,fun);
65 template<
class Object>
66 gsXmlNode * putMaterialMatrixToXml ( Object
const & obj, gsXmlTree & data)
69 typedef typename Object::Scalar_t T;
74 internal::gsXml<Object>::type().c_str(), data) );
76 GISMO_ASSERT(obj.hasThickness(),
"Thickness is not assigned");
78 gsXmlNode * tfun = putFunctionToXml<T>(obj.getThickness(), data, 0);
84 gsXmlNode * rfun = putFunctionToXml<T>(obj.getDensity(), data, 0);
90 for (
index_t k=0; k!=obj.numParameters(); k++)
92 gsXmlNode * pfun = putFunctionToXml<T>(obj.getParameter(k), data, k);
Provides declaration of FunctionExpr class.
#define index_t
Definition: gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
Provides implementation of generic XML functions.
gsXmlAttribute * makeAttribute(const std::string &name, const std::string &value, gsXmlTree &data)
Helper to allocate XML attribute.
Definition: gsXml.cpp:37
gsXmlNode * makeNode(const std::string &name, gsXmlTree &data)
Helper to allocate XML node.
Definition: gsXml.cpp:54