Commit a451df9f authored by Cody Permann's avatar Cody Permann

First version of Stork

parents
This diff is collapsed.
###############################################################################
################### MOOSE Application Standard Makefile #######################
###############################################################################
#
# Required Make variables
# APP_NAME - the name of this application (all lower case)
# MOOSE_DIR - location of the MOOSE framework
# ELK_DIR - location of ELK (if enabled)
# BISON_DIR - location of BISON
# MARMOT_DIR - location of MARMOT
#
# Optional Environment variables
# CURR_DIR - current directory (DO NOT MODIFY THIS VARIABLE)
#
#
# Note: Make sure that there is no whitespace after the word 'yes' if enabling
# an application
###############################################################################
CURR_DIR ?= $(shell pwd)
ROOT_DIR ?= $(shell dirname `pwd`)
ifeq ($(MOOSE_DEV),true)
MOOSE_DIR ?= $(ROOT_DIR)/devel/moose
else
MOOSE_DIR ?= $(ROOT_DIR)/moose
endif
ELK_DIR ?= $(ROOT_DIR)/elk
STORK_DIR ?= $(ROOT_DIR)/stork
APPLICATION_NAME := stork
DEP_APPS ?= $(shell $(MOOSE_DIR)/scripts/find_dep_apps.py $(APPLICATION_NAME))
################################## ELK MODULES ################################
ALL_ELK_MODULES := yes
###############################################################################
include $(MOOSE_DIR)/build.mk
include $(MOOSE_DIR)/moose.mk
include $(ELK_DIR)/elk.mk
include $(STORK_DIR)/stork.mk
###############################################################################
# Additional special case targets should be added here
This diff is collapsed.
<style type="text/css">
h1 { text-align: center; }
</style>
This diff is collapsed.
<script type="text/javascript">
function toggleNext(el) {
var next=el;
next.style.display=((next.style.display=="none") ? "block" : "none");
}
function toggleNextClick(classname) {
elementlist=document.getElementsByClassName(classname.className);
elementlist[1].style.display="block";
elementlist[0].onclick="";
}
function getElementsByTagAndClassName(tag,cname) {
var tags=document.getElementsByTagName(tag);
var cEls=new Array();
for (i=0; i<tags.length; i++) {
var rE = new RegExp("(^|\s)" + cname + "(\s|$)");
if (rE.test(tags[i].className)) {
cEls.push(tags[i]);
}
}
return cEls;
}
function toggleNextByTagAndClassName(tag,cname) {
var ccn="clicker";
clickers=getElementsByTagAndClassName(tag,cname);
viewers=getElementsByTagAndClassName('pre',cname);
for (i=0; i<clickers.length; i++) {
clickers[i].className+=" "+ccn+" clicker"+i;
viewers[i].className="fragment clicker "+ccn+i;
clickers[i].onclick=function() {toggleNextClick(this)}
toggleNext(viewers[i]);
}
if (document.getElementsByTagName('pre').length==1) {
document.getElementsByClassName('clicker')[1].style.display="block"
document.getElementsByClassName('clicker')[0].onclick=""
}
}
window.onload=function(){toggleNextByTagAndClassName('div','fragment')}
</script>
<style>
.clicker {
cursor:pointer;
color:blue;
}
div.fragment:before {
content: 'view code';
}
</style>
<a href="classes.html">Doxygen Class Index</a> -:- <a href="https://hpcsc.inl.gov/moose/wiki/Stork">Back to Stork</a><br><br>
<LINK rel="stylesheet" href="doxygen.css" type="text/css">
/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */
div.navigation {
display:block;
float:left;
clear:both;
width:100%;
padding-top:10px;
padding-bottom:30px;
border-bottom:1px dotted #E0E0E0;
height: 60px;
background:url(background_navigation.png);
}
div.contents {
float:left;
clear:both;
}
address {
display:none;
}
DIV.tabs
{
float : left;
width : 100%;
margin-bottom : 4px;
}
DIV.tabs UL
{
margin : 0px;
padding-left : 0px;
list-style : none;
}
DIV.tabs LI, DIV.tabs FORM
{
display : inline;
margin : 0px;
padding : 0px;
background-color:#FFFFFF;
}
DIV.tabs FORM
{
float : right;
}
DIV.tabs A
{
float : left;
font-size : 80%;
font-weight : bold;
text-decoration : none;
}
DIV.tabs A:hover
{
background-position: 100% -150px;
}
DIV.tabs A:link, DIV.tabs A:visited,
DIV.tabs A:active, DIV.tabs A:hover
{
color: #1A419D;
}
DIV.tabs SPAN
{
float : left;
display : block;
padding : 5px 9px;
white-space : nowrap;
border-top:1px dotted #E0E0E0;
border-bottom:1px dotted #E0E0E0;
}
DIV.tabs #MSearchBox
{
float : right;
display : inline;
font-size : 1em;
}
DIV.tabs TD
{
font-size : 80%;
font-weight : bold;
text-decoration : none;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
DIV.tabs SPAN {float : none;}
/* End IE5-Mac hack */
DIV.tabs A:hover SPAN
{
background-position: 0% -150px;
}
DIV.tabs LI.current A
{
background-position: 100% -150px;
border-width : 0px;
background-color: #F0F0F0;
background: #F0F0F0 url(img_downArrow.png) center bottom no-repeat;
}
DIV.tabs LI.current SPAN
{
background-position: 0% -150px;
padding-bottom : 6px;
}
DIV.navpath
{
background : none;
border : none;
border-bottom : 1px solid #84B0C7;
text-align : center;
margin : 2px;
padding : 2px;
}
#ifndef STORKAPP_H
#define STORKAPP_H
#include "MooseApp.h"
class StorkApp;
template<>
InputParameters validParams<StorkApp>();
class StorkApp : public MooseApp
{
public:
StorkApp(const std::string & name, InputParameters parameters);
virtual ~StorkApp();
static void registerApps();
static void registerObjects(Factory & factory);
static void associateSyntax(Syntax & syntax, ActionFactory & action_factory);
};
#endif /* STORKAPP_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
from optparse import OptionParser
from shutil import copytree, ignore_patterns
global_ignores = ['.svn']
global_app_name = ''
def renameFiles(app_path):
pattern = re.compile(r'(stork)(.*)', re.I)
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 = 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))
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.replace(global_app_name, 'stork')).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
return_string = string.upper(global_app_name)
if match.group(1) == 'STORK':
return string.upper(global_app_name)
# Case 3: First letter is capitalized
return_string = string.capitalize(global_app_name)
if match.group(1) == 'Stork':
return string.capitalize(return_string)
print match.group(0) + "\nBad Case Detected!"
sys.exit(1)
def printUsage():
print './make_new_application.py <animal name>'
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) != 1:
printUsage()
# Get the trunk directory - ASSUMPTION - it should be one up from here ;)
trunk_path = os.path.abspath('../')
global_app_name = string.lower(args[0])
app_path = trunk_path + '/' + global_app_name
# Copy the directory
copytree('.', app_path, ignore=ignore_patterns('.svn', 'make_new_application*'))
renameFiles(app_path)
print 'Your application should be ready:\n' + app_path
#!/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'
MOOSE_DIR = '../moose'
#### See if MOOSE_DIR is already in the environment instead
if os.environ.has_key("MOOSE_DIR"):
MOOSE_DIR = os.environ['MOOSE_DIR']
elif os.environ.has_key("MOOSE_DEV"):
MOOSE_DIR = '../devel/moose'
# Import the TestHarness and Helper functions from the MOOSE toolkit
sys.path.append(MOOSE_DIR + '/scripts/common')
sys.path.append(MOOSE_DIR + '/scripts/TestHarness')
import tools
# create an instance of the test harness passing in the main arg vector
# and the name of the application
tools.runTests(sys.argv, app_name, MOOSE_DIR)
#include "StorkApp.h"
#include "Moose.h"
#include "ElkApp.h"
#include "AppFactory.h"
template<>
InputParameters validParams<StorkApp>()
{
InputParameters params = validParams<MooseApp>();
return params;
}
StorkApp::StorkApp(const std::string & name, InputParameters parameters) :
MooseApp(name, parameters)
{
srand(libMesh::processor_id());
Moose::registerObjects(_factory);
ElkApp::registerObjects(_factory);
StorkApp::registerObjects(_factory);
Moose::associateSyntax(_syntax, _action_factory);
ElkApp::associateSyntax(_syntax, _action_factory);
StorkApp::associateSyntax(_syntax, _action_factory);
}
StorkApp::~StorkApp()
{
}
void
StorkApp::registerApps()
{
registerApp(StorkApp);
}
void
StorkApp::registerObjects(Factory & factory)
{
}
void
StorkApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
}
#include "StorkApp.h"
#include "MooseInit.h"
#include "Moose.h"
#include "MooseApp.h"
#include "AppFactory.h"
// Create a performance log
PerfLog Moose::perf_log("Stork");
// Begin the main program.
int main(int argc, char *argv[])
{
// Initialize MPI, solvers and MOOSE
MooseInit init(argc, argv);
// Register this application's MooseApp and any it depends on
StorkApp::registerApps();
// This creates dynamic memory that we're responsible for deleting
MooseApp * app = AppFactory::createApp("StorkApp", argc, argv);
// Execute the application
app->run();
// Free up the memory we created earlier
delete app;
return 0;
}
stork_INC_DIRS := $(shell find $(STORK_DIR)/include -type d -not -path "*/.svn*")
stork_INCLUDE := $(foreach i, $(stork_INC_DIRS), -I$(i))
libmesh_INCLUDE := $(stork_INCLUDE) $(libmesh_INCLUDE)
stork_LIB := $(STORK_DIR)/libstork-$(METHOD).la
stork_APP := $(STORK_DIR)/stork-$(METHOD)
# source files
stork_srcfiles := $(shell find $(STORK_DIR)/src -name "*.C" -not -name main.C)
stork_csrcfiles := $(shell find $(STORK_DIR)/src -name "*.c")
stork_fsrcfiles := $(shell find $(STORK_DIR)/src -name "*.f")
stork_f90srcfiles := $(shell find $(STORK_DIR)/src -name "*.f90")
# object files
stork_objects := $(patsubst %.C, %.$(obj-suffix), $(stork_srcfiles))
stork_objects += $(patsubst %.c, %.$(obj-suffix), $(stork_csrcfiles))
stork_objects += $(patsubst %.f, %.$(obj-suffix), $(stork_fsrcfiles))
stork_objects += $(patsubst %.f90, %.$(obj-suffix), $(stork_f90srcfiles))
# plugin files
stork_plugfiles := $(shell find $(STORK_DIR)/plugins/ -name "*.C" 2>/dev/null)
stork_cplugfiles := $(shell find $(STORK_DIR)/plugins/ -name "*.c" 2>/dev/null)
stork_fplugfiles := $(shell find $(STORK_DIR)/plugins/ -name "*.f" 2>/dev/null)
stork_f90plugfiles := $(shell find $(STORK_DIR)/plugins/ -name "*.f90" 2>/dev/null)
# plugins
stork_plugins := $(patsubst %.C, %-$(METHOD).plugin, $(stork_plugfiles))
stork_plugins += $(patsubst %.c, %-$(METHOD).plugin, $(stork_cplugfiles))
stork_plugins += $(patsubst %.f, %-$(METHOD).plugin, $(stork_fplugfiles))
stork_plugins += $(patsubst %.f90, %-$(METHOD).plugin, $(stork_f90plugfiles))
# stork main
stork_main_src := $(STORK_DIR)/src/main.C
stork_app_objects := $(patsubst %.C, %.$(obj-suffix), $(stork_main_src))
# dependency files
stork_deps := $(patsubst %.C, %.$(obj-suffix).d, $(stork_srcfiles)) \
$(patsubst %.c, %.$(obj-suffix).d, $(stork_csrcfiles)) \
$(patsubst %.C, %.$(obj-suffix).d, $(stork_main_src))
# clang static analyzer files
stork_analyzer := $(patsubst %.C, %.plist.$(obj-suffix), $(stork_srcfiles))
# If building shared libs, make the plugins a dependency, otherwise don't.
ifeq ($(libmesh_shared),yes)
stork_plugin_deps := $(stork_plugins)
else
stork_plugin_deps :=
endif
all:: $(stork_LIB)
$(stork_LIB): $(stork_objects) $(stork_plugin_deps)
@echo "Linking "$@"..."
@$(libmesh_LIBTOOL) --tag=CXX $(LIBTOOLFLAGS) --mode=link --quiet \
$(libmesh_CXX) $(libmesh_CXXFLAGS) -o $@ $(stork_objects) $(libmesh_LIBS) $(libmesh_LDFLAGS) $(EXTERNAL_FLAGS) -rpath $(STORK_DIR)
@$(libmesh_LIBTOOL) --mode=install --quiet install -c $(stork_LIB) $(STORK_DIR)
# Clang static analyzer
sa:: $(stork_analyzer)
# include STORK dep files
-include $(stork_deps)
# how to build STORK application
ifeq ($(APPLICATION_NAME),stork)
all:: stork
stork: $(stork_APP)
$(stork_APP): $(moose_LIB) $(elk_MODULES) $(stork_LIB) $(stork_app_objects)
@echo "Linking "$@"..."
@$(libmesh_LIBTOOL) --tag=CXX $(LIBTOOLFLAGS) --mode=link --quiet \
$(libmesh_CXX) $(libmesh_CXXFLAGS) -o $@ $(stork_app_objects) $(stork_LIB) $(elk_MODULES) $(moose_LIB) $(libmesh_LIBS) $(libmesh_LDFLAGS) $(ADDITIONAL_LIBS)
endif
#
# Maintenance
#
delete_list := $(stork_APP) $(stork_LIB) $(STORK_DIR)/libstork-$(METHOD).*
cleanall::
make -C $(STORK_DIR) clean
###############################################################################
# Additional special case targets should be added here
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
[]
[Variables]
[./u]
[../]
[]
[Kernels]
[./diff]
type = Diffusion
variable = u
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = u
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = u
boundary = right
value = 1
[../]
[]
[Executioner]
type = Steady
#Preconditioned JFNK (default)
solve_type = 'PJFNK'
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Output]
linear_residuals = true
output_initial = true
exodus = true
perf_log = true
[]
[Tests]
[./test]
type = 'Exodiff'
input = 'simple_diffusion.i'
exodiff = 'simple_diffusion_out.e'
[../]
[]
\ No newline at end of file
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