How to Add a New Element (Condition)
From KratosWiki
(Difference between revisions)
(Created page with "'''1'''.'''Adding & Registeration''': In the application's .cpp file '''add''' new element (i.e. linear_element) as below mLinearElement2D3N(0, Element::GeometryType::Pointer(ne...") |
|||
(2 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | '''1'''.'''Adding & Registeration''': In the application's .cpp file '''add''' new element (i.e. linear_element) as below | + | '''1'''.'''Adding & Registeration''': In the application's .cpp file of the relating application'''add''' new element (i.e. linear_element) as below |
+ | |||
mLinearElement2D3N(0, Element::GeometryType::Pointer(new Triangle2D<Node<3> > | mLinearElement2D3N(0, Element::GeometryType::Pointer(new Triangle2D<Node<3> > | ||
(Element::GeometryType::PointsArrayType(3, Node<3>())))), | (Element::GeometryType::PointsArrayType(3, Node<3>())))), | ||
''2D'' represents for 2 dimensional and ''3N'' for three-nodded element. | ''2D'' represents for 2 dimensional and ''3N'' for three-nodded element. | ||
− | In the '''register''' section: | + | In the '''register''' section of the same file: |
KRATOS_REGISTER_ELEMENT("LinearElement2D3N", mLinearElement2D3N) | KRATOS_REGISTER_ELEMENT("LinearElement2D3N", mLinearElement2D3N) | ||
Line 13: | Line 14: | ||
const LinearElement mLinearElement2D3N; | const LinearElement mLinearElement2D3N; | ||
− | Trivially, if you are working in Linux there would be a '' | + | 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 | ...list of files to be build | ||
− | linear_element.cpp | + | ${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'''. |
Latest revision as of 09:40, 3 May 2012
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.