How to Add a New Element (Condition)

From KratosWiki
Jump to: navigation, search

1.Adding & Registeration: In the application's .cpp file of the relating applicationadd new element (i.e. linear_element) as below

mLinearElement2D3N(0, Element::GeometryType::Pointer(new Triangle2D<Node<3>  >
(Element::GeometryType::PointsArrayType(3, Node<3>())))),

2D represents for 2 dimensional and 3N for three-nodded element. In the register section of the same file:

KRATOS_REGISTER_ELEMENT("LinearElement2D3N", mLinearElement2D3N)

2.Including: In the application's .h file simply include header file,

#include "custom_elements/linear_element.h"

add the element as the member variable of the application's class

...class KratosR1StructuralApplication : public KratosApplication
...Private:
const LinearElement  mLinearElement2D3N;

Trivially, if you are working in Linux there would be a CMakeLists.txt, in application folder, the .cpp file to is to be added inside

...list of files to be build 
   ${CMAKE_CURRENT_SOURCE_DIR}/custom_elements/linear_element.cpp

The same steps are necessary to add a new Condition, with minor changes respect changing from Element to Condition.

Personal tools
Categories