Commit 2a58b0db authored by Ron Rahaman's avatar Ron Rahaman

Initial commit after restructuring Stork repo

parent 438434f7
......@@ -26,7 +26,7 @@ include $(MOOSE_DIR)/modules/modules.mk
# dep apps
APPLICATION_DIR := $(CURDIR)
APPLICATION_NAME := stork
APPLICATION_NAME := MOON
BUILD_EXEC := yes
DEP_APPS := $(shell $(FRAMEWORK_DIR)/scripts/find_dep_apps.py $(APPLICATION_NAME))
include $(FRAMEWORK_DIR)/app.mk
......
###############################################################################
################### MOOSE Application Standard Makefile #######################
###############################################################################
#
# Optional Environment variables
# MOOSE_DIR - Root directory of the MOOSE project
# HERD_TRUNK_DIR - Location of the HERD repository
# FRAMEWORK_DIR - Location of the MOOSE framework
#
###############################################################################
MODULE_DIR ?= $(shell dirname `pwd`)
MOOSE_DIR ?= $(shell dirname $(MODULE_DIR))
FRAMEWORK_DIR ?= $(MOOSE_DIR)/framework
###############################################################################
# framework
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk
# dep apps
APPLICATION_DIR := $(MODULE_DIR)/stork
APPLICATION_NAME := stork
BUILD_EXEC := yes
DEP_APPS := $(shell $(FRAMEWORK_DIR)/scripts/find_dep_apps.py $(APPLICATION_NAME))
include $(FRAMEWORK_DIR)/app.mk
###############################################################################
# Additional special case targets should be added here
Stork
Moon
=====
"Fork Stork" to create a new MOOSE-based application.
"Fork Moon" to create a new MOOSE-based application.
For more information see: [http://mooseframework.org/create-an-app/](http://mooseframework.org/create-an-app/)
......@@ -4,7 +4,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "stork"
PROJECT_NAME = "MOON"
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
......
#ifndef STORKAPP_H
#define STORKAPP_H
#ifndef MOONAPP_H
#define MOONAPP_H
#include "MooseApp.h"
class StorkApp;
class MoonApp;
template<>
InputParameters validParams<StorkApp>();
InputParameters validParams<MoonApp>();
class StorkApp : public MooseApp
class MoonApp : public MooseApp
{
public:
StorkApp(InputParameters parameters);
virtual ~StorkApp();
MoonApp(InputParameters parameters);
virtual ~MoonApp();
static void registerApps();
static void registerObjects(Factory & factory);
static void associateSyntax(Syntax & syntax, ActionFactory & action_factory);
};
#endif /* STORKAPP_H */
#endif /* MOONAPP_H */
#!/usr/bin/env python
# This script is for creating a new herd animal. Just run this script
# from the "stork" directory supplying a new animal name and it should
# create a complete application template built with support for both
# MOOSE and ELK. Enjoy!
import os, sys, string, re, subprocess
from optparse import OptionParser
from shutil import copytree, ignore_patterns
# DO NOT MODIFY
# This value should be set to true if this stork is within the svn herd repository
global_in_herd = False
global_ignores = ['.svn', '.git']
global_app_name = ''
global_rename_suffix = 'app'
def renameFiles(app_path):
rename_pattern = re.compile(r'(stork)(.*)', re.I)
suffix_pattern = re.compile(r'(.*)\.' + global_rename_suffix + '$')
for dirpath, dirnames, filenames in os.walk(app_path):
# Don't traverse into ignored directories
for ignore in global_ignores:
if ignore in dirnames:
dirnames.remove(ignore)
for file in filenames:
match = rename_pattern.match(file)
# Replace 'stork' in the contents
replaceNameInContents(dirpath + '/' + file)
# See if the file needs to be renamed and rename
if match != None:
replace_string = replacementFunction(match)
os.rename(dirpath + '/' + file, dirpath + '/' + replace_string + match.group(2))
# update the file
file = replace_string + match.group(2)
# If there are files with .app suffixes drop the suffix
match = suffix_pattern.search(file)
if match != None:
os.rename(dirpath + '/' + file, dirpath + '/' + match.group(1))
def replaceNameInContents(filename):
f = open(filename)
text = f.read()
f.close()
# Replace all instances of the word stork with the right case
pattern = re.compile(r'(stork)', re.I)
text = pattern.sub(replacementFunction, text)
# Retrieve original file attribute to be applied later
mode = os.stat(filename).st_mode
# Now write the file back out
f = open(filename + '~tmp', 'w')
f.write(text)
f.close()
os.chmod(filename + '~tmp', mode)
os.rename(filename + '~tmp', filename)
def replacementFunction(match):
# There are 3 "case" cases
# Case 1: all lower case
if match.group(1) == 'stork':
return global_app_name
# Case 2: all upper case
if match.group(1) == 'STORK':
return string.upper(global_app_name)
# Case 3: First letter is capitalized
if match.group(1) == 'Stork':
name = global_app_name.replace("_", " ")
name = name.title()
name = name.replace(" ", "")
return name
print match.group(0) + "\nBad Case Detected!"
sys.exit(1)
if __name__ == '__main__':
parser = OptionParser()
(global_options, args) = parser.parse_args()
# Get the animal name
if global_in_herd:
if len(args) != 1:
print 'Usage: ./make_new_application.py <animal name>'
sys.exit()
global_app_name = string.lower(args[0])
else:
if len(args) != 0:
print 'Usage: ./make_new_application.py'
sys.exit()
global_app_name = os.path.basename(os.path.dirname(os.path.realpath(__file__)))
# Make the new application
if global_in_herd:
copytree('.', '../' + global_app_name, ignore=ignore_patterns('.svn', '.git', '*.module', 'make_new*', 'LICENSE'))
renameFiles('../' + global_app_name)
print 'Your application should be ready!\nAdd the directory ../' + global_app_name + ' to your checkout and commit.'
else:
# We are in a git clone
renameFiles('.')
try:
os.remove('Makefile.module')
os.remove('run_tests.module')
os.remove(os.path.join('src', 'base', 'StorkApp.C.module'))
os.remove('make_new_application.py')
os.remove('make_new_module.py')
except:
pass
# Add the newly created untracked files and delete the removed ones
subprocess.check_output("git rm -f *.py Makefile.* run_tests.*", shell=True)
subprocess.call("git add --all *", shell=True)
print 'Your application should be ready!\nCommit this directory to your local repository and push.'
#!/usr/bin/env python
# This script is for creating a new herd animal. Just run this script
# from the "stork" directory supplying a new animal name and it should
# create a complete application template built with support for both
# MOOSE and ELK. Enjoy!
import os, sys, string, re, subprocess
from optparse import OptionParser
from shutil import copytree, ignore_patterns
global_ignores = ['.svn', '.git']
global_app_name = ''
global_app_name_stripped = ''
global_rename_suffix = 'module'
def renameFiles(app_path):
rename_pattern = re.compile(r'(stork)(.*)', re.I)
suffix_pattern = re.compile(r'(.*)\.' + global_rename_suffix + '$')
for dirpath, dirnames, filenames in os.walk(app_path):
# Don't traverse into ignored directories
for ignore in global_ignores:
if ignore in dirnames:
dirnames.remove(ignore)
for file in filenames:
match = rename_pattern.match(file)
# Replace 'stork' in the contents
replaceNameInContents(dirpath + '/' + file)
# See if the file needs to be renamed and rename
if match != None:
replace_string = replacementFunction(match)
os.rename(dirpath + '/' + file, dirpath + '/' + replace_string + match.group(2))
# update the file
file = replace_string + match.group(2)
# If there are files with .app suffixes drop the suffix
match = suffix_pattern.search(file)
if match != None:
os.rename(dirpath + '/' + file, dirpath + '/' + match.group(1))
def replaceNameInContents(filename):
f = open(filename)
text = f.read()
f.close()
# Replace all instances of the word stork with the right case
pattern = re.compile(r'(stork)', re.I)
text = pattern.sub(replacementFunction, text)
# Retrieve original file attribute to be applied later
mode = os.stat(filename).st_mode
# Now write the file back out
f = open(filename + '~tmp', 'w')
f.write(text)
f.close()
os.chmod(filename + '~tmp', mode)
os.rename(filename + '~tmp', filename)
def replacementFunction(match):
# There are 3 "case" cases
# Case 1: all lower case
if match.group(1) == 'stork':
return global_app_name_stripped
# Case 2: all upper case
if match.group(1) == 'STORK':
return string.upper(global_app_name_stripped)
# Case 3: First letter is capitalized
if match.group(1) == 'Stork':
name = global_app_name_stripped.replace("_", " ")
name = name.title()
name = name.replace(" ", "")
return name
print match.group(0) + "\nBad Case Detected!"
sys.exit(1)
def printUsage():
print './make_new_module.py <module name> <moose dir>'
sys.exit()
if __name__ == '__main__':
parser = OptionParser()
(global_options, args) = parser.parse_args()
# Make sure an animal name was supplied (args[0])
if len(args) != 2:
printUsage()
modules_dir = args[1] + '/modules/'
if not os.path.exists(modules_dir):
print "Unable to access ", modules_dir
sys.exit()
global_app_name = string.lower(args[0])
global_app_name_stripped = global_app_name
m = re.search(r'(\D*)', global_app_name)
if m != None:
global_app_name_stripped = m.group(1)
# Copy the directory
copytree('.', modules_dir + global_app_name, ignore=ignore_patterns('.svn', '.git', '*.app', 'make_new*', 'LICENSE'))
renameFiles(modules_dir + global_app_name)
print 'Your new module should be ready!\nYou need to edit the following files to include your new module into MOOSE:'
print modules_dir + 'modules.mk'
print modules_dir + 'combined/src/base/ModulesApp.C'
......@@ -5,7 +5,7 @@ import sys, os, inspect
os.chdir(os.path.abspath(os.path.dirname(sys.argv[0])))
#### Set the name of the application here and moose directory relative to the application
app_name = 'stork'
app_name = 'MOON'
MOOSE_DIR = os.path.abspath(os.path.join('..', 'moose'))
#### See if a submodule is available
......
#!/usr/bin/env python
import sys, os
# Set the current working directory to the directory where this script is located
os.chdir(os.path.abspath(os.path.dirname(sys.argv[0])))
#### Set the name of the application here and moose directory relative to the application
app_name = 'stork'
MODULE_DIR = os.path.abspath('..')
MOOSE_DIR = os.path.abspath(os.path.join(MODULE_DIR, '..'))
#### See if MOOSE_DIR is already in the environment instead
if os.environ.has_key("MOOSE_DIR"):
MOOSE_DIR = os.environ['MOOSE_DIR']
sys.path.append(os.path.join(MOOSE_DIR, 'python'))
import path_tool
path_tool.activate_module('TestHarness')
from TestHarness import TestHarness
# Run the tests!
TestHarness.buildAndRun(sys.argv, app_name, MOOSE_DIR)
#include "StorkApp.h"
#include "MoonApp.h"
#include "Moose.h"
#include "AppFactory.h"
#include "ModulesApp.h"
#include "MooseSyntax.h"
template<>
InputParameters validParams<StorkApp>()
InputParameters validParams<MoonApp>()
{
InputParameters params = validParams<MooseApp>();
......@@ -16,40 +16,40 @@ InputParameters validParams<StorkApp>()
return params;
}
StorkApp::StorkApp(InputParameters parameters) :
MoonApp::MoonApp(InputParameters parameters) :
MooseApp(parameters)
{
Moose::registerObjects(_factory);
ModulesApp::registerObjects(_factory);
StorkApp::registerObjects(_factory);
MoonApp::registerObjects(_factory);
Moose::associateSyntax(_syntax, _action_factory);
ModulesApp::associateSyntax(_syntax, _action_factory);
StorkApp::associateSyntax(_syntax, _action_factory);
MoonApp::associateSyntax(_syntax, _action_factory);
}
StorkApp::~StorkApp()
MoonApp::~MoonApp()
{
}
// External entry point for dynamic application loading
extern "C" void StorkApp__registerApps() { StorkApp::registerApps(); }
extern "C" void MoonApp__registerApps() { MoonApp::registerApps(); }
void
StorkApp::registerApps()
MoonApp::registerApps()
{
registerApp(StorkApp);
registerApp(MoonApp);
}
// External entry point for dynamic object registration
extern "C" void StorkApp__registerObjects(Factory & factory) { StorkApp::registerObjects(factory); }
extern "C" void MoonApp__registerObjects(Factory & factory) { MoonApp::registerObjects(factory); }
void
StorkApp::registerObjects(Factory & factory)
MoonApp::registerObjects(Factory & factory)
{
}
// External entry point for dynamic syntax association
extern "C" void StorkApp__associateSyntax(Syntax & syntax, ActionFactory & action_factory) { StorkApp::associateSyntax(syntax, action_factory); }
extern "C" void MoonApp__associateSyntax(Syntax & syntax, ActionFactory & action_factory) { MoonApp::associateSyntax(syntax, action_factory); }
void
StorkApp::associateSyntax(Syntax & /*syntax*/, ActionFactory & /*action_factory*/)
MoonApp::associateSyntax(Syntax & /*syntax*/, ActionFactory & /*action_factory*/)
{
}
#include "StorkApp.h"
#include "MoonApp.h"
#include "Moose.h"
#include "AppFactory.h"
#include "MooseSyntax.h"
template<>
InputParameters validParams<StorkApp>()
InputParameters validParams<MoonApp>()
{
InputParameters params = validParams<MooseApp>();
......@@ -15,38 +15,38 @@ InputParameters validParams<StorkApp>()
return params;
}
StorkApp::StorkApp(InputParameters parameters) :
MoonApp::MoonApp(InputParameters parameters) :
MooseApp(parameters)
{
Moose::registerObjects(_factory);
StorkApp::registerObjects(_factory);
MoonApp::registerObjects(_factory);
Moose::associateSyntax(_syntax, _action_factory);
StorkApp::associateSyntax(_syntax, _action_factory);
MoonApp::associateSyntax(_syntax, _action_factory);
}
StorkApp::~StorkApp()
MoonApp::~MoonApp()
{
}
// External entry point for dynamic application loading
extern "C" void StorkApp__registerApps() { StorkApp::registerApps(); }
extern "C" void MoonApp__registerApps() { MoonApp::registerApps(); }
void
StorkApp::registerApps()
MoonApp::registerApps()
{
registerApp(StorkApp);
registerApp(MoonApp);
}
// External entry point for dynamic object registration
extern "C" void StorkApp__registerObjects(Factory & factory) { StorkApp::registerObjects(factory); }
extern "C" void MoonApp__registerObjects(Factory & factory) { MoonApp::registerObjects(factory); }
void
StorkApp::registerObjects(Factory & factory)
MoonApp::registerObjects(Factory & factory)
{
}
// External entry point for dynamic syntax association
extern "C" void StorkApp__associateSyntax(Syntax & syntax, ActionFactory & action_factory) { StorkApp::associateSyntax(syntax, action_factory); }
extern "C" void MoonApp__associateSyntax(Syntax & syntax, ActionFactory & action_factory) { MoonApp::associateSyntax(syntax, action_factory); }
void
StorkApp::associateSyntax(Syntax & /*syntax*/, ActionFactory & /*action_factory*/)
MoonApp::associateSyntax(Syntax & /*syntax*/, ActionFactory & /*action_factory*/)
{
}
#include "StorkApp.h"
#include "MoonApp.h"
#include "MooseInit.h"
#include "Moose.h"
#include "MooseApp.h"
#include "AppFactory.h"
// Create a performance log
PerfLog Moose::perf_log("Stork");
PerfLog Moose::perf_log("Moon");
// Begin the main program.
int main(int argc, char *argv[])
......@@ -14,10 +14,10 @@ int main(int argc, char *argv[])
MooseInit init(argc, argv);
// Register this application's MooseApp and any it depends on
StorkApp::registerApps();
MoonApp::registerApps();
// This creates dynamic memory that we're responsible for deleting
MooseApp * app = AppFactory::createApp("StorkApp", argc, argv);
MooseApp * app = AppFactory::createApp("MoonApp", argc, argv);
// Execute the application
app->run();
......
......@@ -31,19 +31,19 @@ ADDITIONAL_LIBS := -L$(CPPUNIT_DIR)/lib -lcppunit
# dep apps
APPLICATION_DIR := $(CURRENT_DIR)/..
APPLICATION_NAME := stork
APPLICATION_NAME := MOON
include $(FRAMEWORK_DIR)/app.mk
APPLICATION_DIR := $(CURRENT_DIR)
APPLICATION_NAME := stork-unit
APPLICATION_NAME := MOON-unit
BUILD_EXEC := yes
DEP_APPS ?= $(shell $(FRAMEWORK_DIR)/scripts/find_dep_apps.py $(APPLICATION_NAME))
include $(FRAMEWORK_DIR)/app.mk
# Find all the STORK unit test source files and include their dependencies.
stork-unit_srcfiles := $(shell find $(CURRENT_DIR) -name "*.C")
stork-unit_deps := $(patsubst %.C, %.$(obj-suffix).d, $(stork-unit_srcfiles))
-include $(stork-unit_deps)
# Find all the MOON unit test source files and include their dependencies.
MOON-unit_srcfiles := $(shell find $(CURRENT_DIR) -name "*.C")
MOON-unit_deps := $(patsubst %.C, %.$(obj-suffix).d, $(MOON-unit_srcfiles))
-include $(MOON-unit_deps)
###############################################################################
# Additional special case targets should be added here
#!/bin/bash
APPLICATION_NAME=stork
APPLICATION_NAME=MOON
# If $METHOD is not set, use opt
if [ -z $METHOD ]; then
export METHOD=opt
......
......@@ -24,7 +24,7 @@
#include "Factory.h"
#include "AppFactory.h"
#include "StorkApp.h"
#include "MoonApp.h"
#include <fstream>
#include <string>
......@@ -35,7 +35,7 @@ int main(int argc, char **argv)
{
MooseInit init(argc, argv);
registerApp(StorkApp);
registerApp(MoonApp);
CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment