29 m_container.resize(size);
78 return m_container.at(k).get();
84 os <<
"Material container with " << m_container.size() <<
" materials.\n";
109 static std::string tag () {
return "MaterialMatrixContainer"; }
110 static std::string type () {
return ""; }
112 GSXML_GET_POINTER(Object);
114 static void get_into(gsXmlNode * node,Object & obj)
116 const int size = atoi(node->first_attribute(
"size")->value());
119 int count =
countByTag(
"MaterialMatrix", node);
120 std::vector<typename gsMaterialMatrixBase<T>::Ptr> mat(count);
121 for (gsXmlNode * child = node->first_node(
"MaterialMatrix"); child; child =
122 child->next_sibling(
"MaterialMatrix"))
124 const int i = atoi(child->first_attribute(
"index")->value());
129 for (gsXmlNode * child = node->first_node(
"group"); child;
130 child = child->next_sibling(
"group"))
132 const int mIndex = atoi(child->first_attribute(
"material")->value());
133 std::istringstream group_str;
134 group_str.str( child->value() );
136 for(
int patch; ( gsGetInt(group_str,patch)); )
137 obj.set(patch,mat[mIndex]);
142 static gsXmlNode * put (
const Object & ,
145 GISMO_ERROR(
"Writing gsMaterialMatrixContainer to Xml is not implemented");
This class defines the base class for material matrices.
Definition gsMaterialMatrixBase.h:33
memory::shared_ptr< gsMaterialMatrixBase > Ptr
Shared pointer for gsGeometry.
Definition gsMaterialMatrixBase.h:41
This class serves as the evaluator of material matrices, based on gsMaterialMatrixBase.
Definition gsMaterialMatrixContainer.h:34
gsMaterialMatrixContainer(index_t size=0)
Constructor.
Definition gsMaterialMatrixContainer.hpp:27
void set(const index_t i, const gsMaterialMatrixBase< T > &mat)
Set a material matrix by copying argument.
Definition gsMaterialMatrixContainer.hpp:58
void add(const gsMaterialMatrixBase< T > &mat)
Add a material matrix by copying argument.
Definition gsMaterialMatrixContainer.hpp:46
void clear()
Clear all function pointers.
Definition gsMaterialMatrixContainer.hpp:89
#define GISMO_ERROR(message)
Definition gsDebug.h:118
int countByTag(const std::string &tag, gsXmlNode *root)
Definition gsXml.cpp:81
shared_ptr< T > make_shared_not_owned(const T *x)
Creates a shared pointer which does not eventually delete the underlying raw pointer....
Definition gsMemory.h:189
shared_ptr< T > make_shared(T *x)
Definition gsMemory.h:181
The G+Smo namespace, containing all definitions for the library.