MooseObject basics

  • All objects in MOOSE inherit from MooseObject
  • Therefore, every object that is created by a user to describe their problem has the same basic structure, this basic structure is given in the following example. (Note, this is not valid MOOSE code.)

MyObject.h

#ifndef MYOBJECT_H 
#define MYOBJECT_H

#include "BaseClass.h" 

class MyObject;

template<>
InputParameters validParams<MyObject>();

class MyObject : public BaseClass
{ 
public:
  MyObject(const InputParameters & parameters);

protected:
  virtual SomeType inheritedMethod();
};

#endif // MYOBJECT_H

MyObject.C

#include "MyObject.h"

template<>
InputParameters validParams<MyObject>()
{
  InputParameters params = validParams<BaseClass>(); 
  return params;
}

MyObject::MyObject(const InputParameters & parameters):
    BaseClass(parameters)
{}

SomeType 
MyObject::inheritedMethod() 
{
  // Do Stuff!
}