Skip to content

Instantly share code, notes, and snippets.

@rwcarlsen
Created March 22, 2018 15:41
Show Gist options
  • Save rwcarlsen/6ad3fdd69b99b621470f5a34b991f6df to your computer and use it in GitHub Desktop.
Save rwcarlsen/6ad3fdd69b99b621470f5a34b991f6df to your computer and use it in GitHub Desktop.
#!/bin/bash
# run this script with one or more arguments that are the directories that hold the code files for
# the objects you want to update.
dirs=$@
appname='YourAppName'
objs='
PotentialAdvection
EFieldAdvection
CoeffParamDiffusion
...
'
actions='
ConvDiffMetaAction meta_action
AddLotsOfAuxVariablesAction meta_action
...
'
for obj in $objs; do
find $dirs | grep "/${obj}\.C$" | xargs perl -0777 -i'' -pe 's/(template <>\nInputParameters\nvalidParams<(\w*)>\(\))/registerMooseObject\("'"$appname"'", \2\);\n\n\1/igs'
done
while read action task; do
find $dirs | grep "/${action}\.C$" | xargs perl -0777 -i'' -pe 's/(template <>\nInputParameters\nvalidParams<(\w*)>\(\))/registerMooseAction\("'"$appname"'", \2, "'"$task"'"\);\n\n\1/igs'
done <<< "$actions"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment