33 #ifndef ELEMENTFACTORY_H
34 #define ELEMENTFACTORY_H
42 #define DECLARE_ELEMENT(CLASS) \
44 static const bool IsRegistered; \
45 static CLASS *new_element(std::vector<unsigned int> connectivity) { return new CLASS(connectivity); };
48 #define RECORD_ELEMENT(CLASS) \
49 const bool CLASS::IsRegistered = ElementFactory::get().record<CLASS>();
76 _elements[T::element_name()] = &T::new_element;
91 Element *
new_element(std::string elementName,
const std::vector<unsigned int> &connectivity);
98 std::map<std::string, std::function<
Element *(
const std::vector<unsigned int>)> >
_elements;
Definition: ElementFactory.hpp:55
bool record()
Registers a new element.
Definition: ElementFactory.hpp:69
ElementFactory()
Definition: ElementFactory.cpp:45
static ElementFactory * _factory
The ElementFacrtory instance.
Definition: ElementFactory.hpp:95
std::map< std::string, unsigned int > _elementsnode_number
Map to access the number of nodes of the elements.
Definition: ElementFactory.hpp:101
Element * new_element(std::string elementName, std::ifstream &stream)
Creates a new element from its name and the stream being read.
Definition: ElementFactory.cpp:69
~ElementFactory()
Definition: ElementFactory.cpp:51
std::map< std::string, std::function< Element *(const std::vector< unsigned int >)> > _elements
Map to access elements static constructor method.
Definition: ElementFactory.hpp:98
static ElementFactory & get()
Definition: ElementFactory.cpp:57
Definition: Element.hpp:50
Definition: Common.hpp:198