When you create a new app with the stork script you get a new application that inherits from MOOSE and all of the physics modules by default, but what if you want to inherit from an existing application? This blog post dives into the details of how you modify you application to do just that!
We highly recommend that you add the application you are branching from as a submodule. This will ensure that update to that application don't surprise you and change the behavior of your tests or simulations without you noticing.
For the purpose of this discussion let's call the application we are branching from "SLUG" and the application that we are creating "ARION" (A specific kind of slug).
I'm assuming that you already have your application created (from stork) and cloned locally
$ cd ~/projects/arion $ git submodule add email@example.com:somename/slug.git
Now you need to tell your Makefile about the new application.
# Add these lines to the arion Makefile underneath the existing "modules" area. # dep apps SLUG_DIR ?= $(CURDIR)/slug APPLICATION_DIR := $(SLUG_DIR) APPLICATION_NAME := slug include $(FRAMEWORK_DIR)/app.mk
These lines take advantage of the fact that all MOOSE-based applications look the same and use the same build system. You are telling the Makefile where to find that application and defining a few variables so that the rules in the generic "app.mk" file are adapted specifically for the application you are including.
Finally you need to update your main "app" file to tell it to use the objects from the dependent application.
# Edit your arion/src/base/ArionApp.C file #include "SlugApp.h" #include "SlugSyntax.h" # in your ArionApp constructor register the app and associate the syntax SlugApp::registerSyntax(_factory); SlugApp::associateSyntax(_syntax, _action_factory); # Finally make sure you register the app itself in registerApps() SlugApp::registerApps();
That's all there is to it.Share on Twitter Share on Facebook