User Tools

Site Tools


dev:element_tutorial

This is an old revision of the document!


Creating an MFM Element

You will need to have the MFM ready to build from source to do this. Follow the instructions at Cloning from Github if you have not done so yet.

This tutorial highlights making a density regulating element which regulates nearby density based on some configurable parameters. The source for the final element is located at

MFMv2/src/elements/include/Element_Creg.h

Copy the Element Template

First, copy:

MFMv2/src/elements/include/Element_Template.h

to

MFMv2/src/elements/include/Element_Creg.h

Create the C++ Compilation file

In order for the compiler to be able to create a compiled version of this Element, you will need to create a small C++ file which associates with it. Create the file:

MFMv2/src/elements/src/Element_Creg.h

Add the line:

#include "Element_Creg.h"

to the top. This compiles the header in its entirety.

Renaming

Many things in the template need to be renamed to reflect the new Element. There are comments throughout the C++ template labeled:

<<TEMPLATE>>

Which supply you with renaming instructions. Whe are more or less going to rename everything we find called “Template” with “Creg”. When you are done following the tags, search the file an make sure there is nothing called “Template”.

dev/element_tutorial.1409772117.txt.gz · Last modified: 2014/09/03 19:21 by tsmall1