Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nek5000
giraffe
Commits
2a58b0db
Commit
2a58b0db
authored
Sep 27, 2016
by
Ron Rahaman
Browse files
Initial commit after restructuring Stork repo
parent
438434f7
Changes
15
Hide whitespace changes
Inline
Side-by-side
Makefile
.app
→
Makefile
View file @
2a58b0db
...
...
@@ -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
...
...
Makefile.module
deleted
100644 → 0
View file @
438434f7
###############################################################################
################### 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
README.md
View file @
2a58b0db
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/
)
doc/doxygen/Doxyfile
View file @
2a58b0db
...
...
@@ -4,7 +4,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "
stork
"
PROJECT_NAME = "
MOON
"
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
...
...
include/base/
Stork
App.h
→
include/base/
Moon
App.h
View file @
2a58b0db
#ifndef
STORK
APP_H
#define
STORK
APP_H
#ifndef
MOON
APP_H
#define
MOON
APP_H
#include
"MooseApp.h"
class
Stork
App
;
class
Moon
App
;
template
<
>
InputParameters
validParams
<
Stork
App
>
();
InputParameters
validParams
<
Moon
App
>
();
class
Stork
App
:
public
MooseApp
class
Moon
App
:
public
MooseApp
{
public:
Stork
App
(
InputParameters
parameters
);
virtual
~
Stork
App
();
Moon
App
(
InputParameters
parameters
);
virtual
~
Moon
App
();
static
void
registerApps
();
static
void
registerObjects
(
Factory
&
factory
);
static
void
associateSyntax
(
Syntax
&
syntax
,
ActionFactory
&
action_factory
);
};
#endif
/*
STORK
APP_H */
#endif
/*
MOON
APP_H */
make_new_application.py
deleted
100755 → 0
View file @
438434f7
#!/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
)
+
"
\n
Bad 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!
\n
Add 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!
\n
Commit this directory to your local repository and push.'
make_new_module.py
deleted
100755 → 0
View file @
438434f7
#!/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
)
+
"
\n
Bad 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!
\n
You 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'
run_tests
.app
→
run_tests
View file @
2a58b0db
...
...
@@ -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
...
...
run_tests.module
deleted
100755 → 0
View file @
438434f7
#!/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
)
src/base/
Stork
App.C
.app
→
src/base/
Moon
App.C
View file @
2a58b0db
#include "
Stork
App.h"
#include
"
Moon
App.h"
#include
"Moose.h"
#include
"AppFactory.h"
#include
"ModulesApp.h"
#include
"MooseSyntax.h"
template
<>
InputParameters validParams<
Stork
App>()
InputParameters
validParams
<
Moon
App
>
()
{
InputParameters
params
=
validParams
<
MooseApp
>
();
...
...
@@ -16,40 +16,40 @@ InputParameters validParams<StorkApp>()
return
params
;
}
StorkApp::Stork
App(InputParameters parameters) :
MoonApp
::
Moon
App
(
InputParameters
parameters
)
:
MooseApp
(
parameters
)
{
Moose
::
registerObjects
(
_factory
);
ModulesApp
::
registerObjects
(
_factory
);
Stork
App::registerObjects(_factory);
Moon
App
::
registerObjects
(
_factory
);
Moose
::
associateSyntax
(
_syntax
,
_action_factory
);
ModulesApp
::
associateSyntax
(
_syntax
,
_action_factory
);
Stork
App::associateSyntax(_syntax, _action_factory);
Moon
App
::
associateSyntax
(
_syntax
,
_action_factory
);
}
Stork
App::~
Stork
App()
Moon
App
::~
Moon
App
()
{
}
// External entry point for dynamic application loading
extern "C" void
Stork
App__registerApps() {
Stork
App::registerApps(); }
extern
"C"
void
Moon
App__registerApps
()
{
Moon
App
::
registerApps
();
}
void
Stork
App::registerApps()
Moon
App
::
registerApps
()
{
registerApp(
Stork
App);
registerApp
(
Moon
App
);
}
// External entry point for dynamic object registration
extern "C" void
Stork
App__registerObjects(Factory & factory) {
Stork
App::registerObjects(factory); }
extern
"C"
void
Moon
App__registerObjects
(
Factory
&
factory
)
{
Moon
App
::
registerObjects
(
factory
);
}
void
Stork
App::registerObjects(Factory & factory)
Moon
App
::
registerObjects
(
Factory
&
factory
)
{
}
// External entry point for dynamic syntax association
extern "C" void
Stork
App__associateSyntax(Syntax & syntax, ActionFactory & action_factory) {
Stork
App::associateSyntax(syntax, action_factory); }
extern
"C"
void
Moon
App__associateSyntax
(
Syntax
&
syntax
,
ActionFactory
&
action_factory
)
{
Moon
App
::
associateSyntax
(
syntax
,
action_factory
);
}
void
Stork
App::associateSyntax(Syntax & /*syntax*/, ActionFactory & /*action_factory*/)
Moon
App
::
associateSyntax
(
Syntax
&
/*syntax*/
,
ActionFactory
&
/*action_factory*/
)
{
}
src/base/
Stork
App.C.module
→
src/base/
Moon
App.C.module
View file @
2a58b0db
#include "
Stork
App.h"
#include "
Moon
App.h"
#include "Moose.h"
#include "AppFactory.h"
#include "MooseSyntax.h"
template
<>
InputParameters
validParams
<
Stork
App
>
()
InputParameters
validParams
<
Moon
App
>
()
{
InputParameters
params
=
validParams
<
MooseApp
>
();
...
...
@@ -15,38 +15,38 @@ InputParameters validParams<StorkApp>()
return
params
;
}
StorkApp
::
Stork
App
(
InputParameters
parameters
)
:
MoonApp
::
Moon
App
(
InputParameters
parameters
)
:
MooseApp
(
parameters
)
{
Moose
::
registerObjects
(
_factory
);
Stork
App
::
registerObjects
(
_factory
);
Moon
App
::
registerObjects
(
_factory
);
Moose
::
associateSyntax
(
_syntax
,
_action_factory
);
Stork
App
::
associateSyntax
(
_syntax
,
_action_factory
);
Moon
App
::
associateSyntax
(
_syntax
,
_action_factory
);
}
Stork
App
::~
Stork
App
()
Moon
App
::~
Moon
App
()
{
}
// External entry point for dynamic application loading
extern
"C"
void
Stork
App__registerApps
()
{
Stork
App
::
registerApps
();
}
extern
"C"
void
Moon
App__registerApps
()
{
Moon
App
::
registerApps
();
}
void
Stork
App
::
registerApps
()
Moon
App
::
registerApps
()
{
registerApp
(
Stork
App
);
registerApp
(
Moon
App
);
}
// External entry point for dynamic object registration
extern
"C"
void
Stork
App__registerObjects
(
Factory
&
factory
)
{
Stork
App
::
registerObjects
(
factory
);
}
extern
"C"
void
Moon
App__registerObjects
(
Factory
&
factory
)
{
Moon
App
::
registerObjects
(
factory
);
}
void
Stork
App
::
registerObjects
(
Factory
&
factory
)
Moon
App
::
registerObjects
(
Factory
&
factory
)
{
}
// External entry point for dynamic syntax association
extern
"C"
void
Stork
App__associateSyntax
(
Syntax
&
syntax
,
ActionFactory
&
action_factory
)
{
Stork
App
::
associateSyntax
(
syntax
,
action_factory
);
}
extern
"C"
void
Moon
App__associateSyntax
(
Syntax
&
syntax
,
ActionFactory
&
action_factory
)
{
Moon
App
::
associateSyntax
(
syntax
,
action_factory
);
}
void
Stork
App
::
associateSyntax
(
Syntax
&
/*syntax*/
,
ActionFactory
&
/*action_factory*/
)
Moon
App
::
associateSyntax
(
Syntax
&
/*syntax*/
,
ActionFactory
&
/*action_factory*/
)
{
}
src/main.C
View file @
2a58b0db
#include
"
Stork
App.h"
#include
"
Moon
App.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
Stork
App
::
registerApps
();
Moon
App
::
registerApps
();
// This creates dynamic memory that we're responsible for deleting
MooseApp
*
app
=
AppFactory
::
createApp
(
"
Stork
App"
,
argc
,
argv
);
MooseApp
*
app
=
AppFactory
::
createApp
(
"
Moon
App"
,
argc
,
argv
);
// Execute the application
app
->
run
();
...
...
unit/Makefile
View file @
2a58b0db
...
...
@@ -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
unit/run_tests
View file @
2a58b0db
#!/bin/bash
APPLICATION_NAME
=
stork
APPLICATION_NAME
=
MOON
# If $METHOD is not set, use opt
if
[
-z
$METHOD
]
;
then
export
METHOD
=
opt
...
...
unit/src/main.C
View file @
2a58b0db
...
...
@@ -24,7 +24,7 @@
#include
"Factory.h"
#include
"AppFactory.h"
#include
"
Stork
App.h"
#include
"
Moon
App.h"
#include
<fstream>
#include
<string>
...
...
@@ -35,7 +35,7 @@ int main(int argc, char **argv)
{
MooseInit
init
(
argc
,
argv
);
registerApp
(
Stork
App
);
registerApp
(
Moon
App
);
CppUnit
::
Test
*
suite
=
CppUnit
::
TestFactoryRegistry
::
getRegistry
().
makeTest
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment