36 typedef typename std::vector<typename gsMaterialMatrixBase<T>::Ptr> Container;
38 typedef typename Container::iterator iterator;
39 typedef typename Container::const_iterator const_iterator;
42 typedef memory::shared_ptr< gsMaterialMatrixContainer >
Ptr;
45 typedef memory::unique_ptr< gsMaterialMatrixContainer >
uPtr;
51 m_container.resize(size);
59 m_container =
give(other.m_container);
99 return m_container.at(k).get();
102 index_t size()
const {
return m_container.size();}
104 std::ostream &print(std::ostream &os)
const
106 os <<
"Piecewise Function with "<<m_container.size() <<
" pieces.\n";
112 return pwf.print(os);
122 Container m_container;
133 class gsXml< gsMaterialMatrixContainer<T> >
137 typedef gsMaterialMatrixContainer<T> Object;
140 GSXML_COMMON_FUNCTIONS(gsMaterialMatrixContainer<T>);
141 static std::string tag () {
return "MaterialMatrixContainer"; }
142 static std::string type () {
return ""; }
144 GSXML_GET_POINTER(Object);
146 static void get_into(gsXmlNode * node,Object & obj)
148 const int size = atoi(node->first_attribute(
"size")->value());
151 int count =
countByTag(
"MaterialMatrix", node);
152 std::vector<typename gsMaterialMatrixBase<T>::Ptr> mat(count);
153 for (gsXmlNode * child = node->first_node(
"MaterialMatrix"); child; child =
154 child->next_sibling(
"MaterialMatrix"))
156 const int i = atoi(child->first_attribute(
"index")->value());
160 obj = gsMaterialMatrixContainer<T>(size);
161 for (gsXmlNode * child = node->first_node(
"group"); child;
162 child = child->next_sibling(
"group"))
164 const int mIndex = atoi(child->first_attribute(
"material")->value());
165 std::istringstream group_str;
166 group_str.str( child->value() );
168 for(
int patch; ( gsGetInt(group_str,patch)); )
169 obj.set(patch,mat[mIndex]);
174 static gsXmlNode * put (
const Object & obj,
177 GISMO_ERROR(
"Writing gsMaterialMatrixContainer to Xml is not implemented");
memory::shared_ptr< gsMaterialMatrixContainer > Ptr
Shared pointer for gsMaterialMatrixContainer.
Definition: gsMaterialMatrixContainer.h:42
shared_ptr< T > make_shared_not_owned(const T *x)
Creates a shared pointer which does not eventually delete the underlying raw pointer. Usefull to refer to objects which should not be destroyed.
Definition: gsMemory.h:189
gsMaterialMatrixContainer(index_t size=0)
Constructor.
Definition: gsMaterialMatrixContainer.h:49
int countByTag(const std::string &tag, gsXmlNode *root)
Definition: gsXml.cpp:81
void set(const index_t i, const gsMaterialMatrixBase< T > &mat)
Set a material matrix by copying argument.
Definition: gsMaterialMatrixContainer.h:80
This class serves as the evaluator of material matrices, based on gsMaterialMatrixBase.
Definition: gsMaterialMatrixContainer.h:33
S give(S &x)
Definition: gsMemory.h:266
#define index_t
Definition: gsConfig.h:32
This class defines the base class for material matrices.
Definition: gsMaterialMatrixBase.h:32
void add(const gsMaterialMatrixBase< T > &mat)
Add a material matrix by copying argument.
Definition: gsMaterialMatrixContainer.h:68
void set(const index_t i, const gsMaterialMatrixBase< T > *mat)
Set a material matrix from a gsMaterialMatrixBase<T>::uPtr.
Definition: gsMaterialMatrixContainer.h:86
memory::unique_ptr< gsMaterialMatrixContainer > uPtr
Unique pointer for gsMaterialMatrixContainer.
Definition: gsMaterialMatrixContainer.h:45
void clear()
Clear all function pointers.
Definition: gsMaterialMatrixContainer.h:116
void set(const index_t i, const typename gsMaterialMatrixBase< T >::Ptr mat)
Set a material matrix from a gsMaterialMatrixBase<T>::uPtr.
Definition: gsMaterialMatrixContainer.h:92
Provides a base class for material matrices.
#define GISMO_ERROR(message)
Definition: gsDebug.h:118
memory::shared_ptr< gsMaterialMatrixBase > Ptr
Shared pointer for gsGeometry.
Definition: gsMaterialMatrixBase.h:41
void add(const gsMaterialMatrixBase< T > *mat)
Add a material matrix from a gsMaterialMatrixBase<T>::uPtr.
Definition: gsMaterialMatrixContainer.h:74
shared_ptr< T > make_shared(T *x)
Definition: gsMemory.h:181