How to Add a New Element (Condition)

From KratosWiki
(Difference between revisions)
Jump to: navigation, search
Line 16: Line 16:
 
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  
 
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

Revision as of 09:37, 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
Personal tools
Categories