Commit 9ce7c5ff authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

expand executable script

a choice between the basic classes can now be made.
anything but NavierStokes will fail miserably at the moment though...
parent 15453f34
#######################################################################
# #
# Copyright 2015 Max Planck Institute #
# for Dynamics and Self-Organization #
# #
# This file is part of bfps. #
# #
# bfps is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published #
# by the Free Software Foundation, either version 3 of the License, #
# or (at your option) any later version. #
# #
# bfps is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with bfps. If not, see <http://www.gnu.org/licenses/> #
# #
# Contact: Cristian.Lalescu@ds.mpg.de #
# #
#######################################################################
import os
import argparse
import .__init__ as bfps
import bfps
from .NavierStokes import NavierStokes
from .FluidResize import FluidResize
from .FluidConvert import FluidConvert
......@@ -12,7 +38,7 @@ class Launcher:
self,
base_class = NavierStokes):
self.base_class = base_class
self.parser = argparse.ArgumentParser(prog = 'bfps')
self.parser = argparse.ArgumentParser(prog = 'bfps ' + self.base_class.__name__)
self.parser.add_argument(
'-v', '--version',
action = 'version',
......
#######################################################################
# #
# Copyright 2015 Max Planck Institute #
# for Dynamics and Self-Organization #
# #
# This file is part of bfps. #
# #
# bfps is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published #
# by the Free Software Foundation, either version 3 of the License, #
# or (at your option) any later version. #
# #
# bfps is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with bfps. If not, see <http://www.gnu.org/licenses/> #
# #
# Contact: Cristian.Lalescu@ds.mpg.de #
# #
#######################################################################
import sys
import argparse
import bfps
from .Launcher import Launcher
from .NavierStokes import NavierStokes
from .FluidConvert import FluidConvert
from .FluidResize import FluidResize
def main():
l = Launcher()
l(sys.argv[1:])
parser = argparse.ArgumentParser(prog = 'bfps')
parser.add_argument(
'-v', '--version',
action = 'version',
version = '%(prog)s ' + bfps.__version__)
parser.add_argument(
'base_class',
choices = ['NavierStokes',
'FluidConvert',
'FluidResize'],
type = str)
opt = parser.parse_args(sys.argv[1:2])
l = eval('Launcher(base_class = {0})'.format(opt.base_class))
l(sys.argv[2:])
return None
if __name__ == '__main__':
......
Supports Markdown
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