Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
swryan committed Nov 5, 2017
1 parent 9ea52e5 commit 6d4174a
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ for simplicity, this example only uses one of each.
work here, not just python scripts!

Here is the script for this external code. It simply reads its inputs, `x` and `y`, from an external file,
does the same computation as the :ref:`Paraboloid Tutorial <paraboloid_tutorial>` and writes the output,
does the same computation as the :ref:`Paraboloid Tutorial <tutorial_paraboloid_analysis>` and writes the output,
`f_xy`, to an output file.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,10 @@ input file.
Let's say you want to replace the second integer in the input file above
with a 7. The code would look like this.

.. testcode:: Parse_Input

parser.mark_anchor("INPUT")
parser.transfer_var(7, 1, 2)
.. embed-test::
openmdao.utils.tests.test_file_wrap.FeatureTestCase.test_parse_input

.. testcode:: Parse_Input
:hide:

from __future__ import print_function
for datum in parser.data:
print(datum)

.. testoutput:: Parse_Input

INPUT
1 7 3
INPUT
10.1 20.2 30.3
A B C

.. index:: mark_anchor

Expand Down Expand Up @@ -259,11 +244,9 @@ additional terms of the array.
The input file templating capability that comes with OpenMDAO is basic but quite
functional. If you need a more powerful templating engine, particularly one that
allows the inclusion of logic in your template files, then you may want to consider
one of the community-developed engines, such as mako_ or django_.

.. _mako: http://www.makotemplates.org/
one of the community-developed templating_ engines.

.. _django: https://docs.djangoproject.com/en/dev/topics/templates/
.. _templating: https://wiki.python.org/moin/Templating

.. todo:: Include some examples with one of the templating engines.

Expand Down
3 changes: 0 additions & 3 deletions openmdao/utils/file_wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

import numpy as np

# public symbols
__all__ = ['InputFileGenerator', 'FileParser']


def _getformat(val):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

from openmdao.utils.file_wrap import InputFileGenerator, FileParser

DIRECTORY = os.path.dirname((os.path.abspath(__file__)))


class TestCase(unittest.TestCase):
""" Test file wrapping functions. """
Expand Down Expand Up @@ -542,7 +544,6 @@ def test_more_delims(self):
op = FileParser()
op.set_file(self.filename)

olddelims = op._delimiter
op.set_delimiters(' \t,=')

op.mark_anchor('anchor')
Expand Down Expand Up @@ -579,5 +580,54 @@ def test_more_delims(self):
self.assertEqual(val, '#$%')


class FeatureTestCase(unittest.TestCase):

def setUp(self):
# if running in doc build, there will be no 'self'
if 'self' in locals():
self.startdir = os.getcwd()
self.tempdir = tempfile.mkdtemp(prefix='test_filewarp_feature-')
else:
os.chdir(DIRECTORY)

# A way to "cheat" and do this without a file.
global parser
parser = InputFileGenerator()
parser.data = []
parser.data.append("INPUT")
parser.data.append("1 2 3")
parser.data.append("INPUT")
parser.data.append("10.1 20.2 30.3")
parser.data.append("A B C")

def show_data(self, data):
text = ''
for row in data:
text = text + row + '\n'
return text

def tearDown(self):
# if running in doc build, there will be no 'self'
if 'self' in locals():
os.chdir(self.startdir)
try:
shutil.rmtree(self.tempdir)
except OSError:
pass

def test_parse_input(self):
parser.mark_anchor("INPUT")
parser.transfer_var(7, 1, 2)
print(parser.data)

# self.assertEquals(parser.data, [
# "INPUT",
# "1 7 3",
# "INPUT",
# "10.1 20.2 30.3",
# "A B C"
# ].join('\n'))


if __name__ == "__main__":
unittest.main()
149 changes: 78 additions & 71 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from distutils.core import setup

setup(name='openmdao',
version='2.0.2',
description="OpenMDAO v2.0 framework infrastructure",
long_description="""OpenMDAO is an open-source high-performance computing platform
for systems analysis and multidisciplinary optimization, written in Python. It
enables you to decompose your models, making them easier to build and maintain,
while still solving them in a tightly coupled manner with efficient parallel numerical methods.
""",
classifiers=[
setup(
name='openmdao',
version='2.0.2',
description="OpenMDAO v2.0 framework infrastructure",
long_description="""OpenMDAO is an open-source high-performance computing platform
for systems analysis and multidisciplinary optimization, written in Python. It
enables you to decompose your models, making them easier to build and maintain,
while still solving them in a tightly coupled manner with efficient parallel numerical methods.
""",
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
Expand All @@ -21,76 +22,82 @@
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
],
keywords='optimization multidisciplinary multi-disciplinary analysis',
author='OpenMDAO Team',
author_email='[email protected]',
url='http://openmdao.org',
download_url='http://github.com/OpenMDAO/OpenMDAO/tarball/2.0.0',
license='Apache License, Version 2.0',
packages=[
'openmdao',
'openmdao.approximation_schemes',
'openmdao.code_review',
'openmdao.components',
'openmdao.core',
'openmdao.devtools',
'openmdao.devtools.problem_viewer',
'openmdao.docs',
'openmdao.drivers',
'openmdao.error_checking',
'openmdao.jacobians',
'openmdao.matrices',
'openmdao.proc_allocators',
'openmdao.recorders',
'openmdao.solvers',
'openmdao.solvers.linear',
'openmdao.solvers.linesearch',
'openmdao.solvers.nonlinear',
'openmdao.test_suite',
'openmdao.test_suite.components',
'openmdao.test_suite.groups',
'openmdao.test_suite.test_examples',
'openmdao.test_suite.test_examples.beam_optimization',
'openmdao.test_suite.test_examples.beam_optimization.components',
'openmdao.utils',
'openmdao.vectors',
'openmdao.surrogate_models',
'openmdao.surrogate_models.nn_interpolators'
],
package_data={
'openmdao.devtools': ['*.wpr', '*.html'],
'openmdao.devtools.problem_viewer': ['visualization/libs/*.js', 'visualization/src/*.js',
'visualization/style/*.css', 'visualization/style/*.woff',
'visualization/*.html'],
'openmdao.docs': ['*.py', '_utils/*.py'],
'openmdao.utils': ['unit_library.ini'],
'openmdao.test_suite': ['*.py', '*/*.py'],
'openmdao': ['*/tests/*.py', '*/*/tests/*.py', '*/*/*/tests/*.py']
},
install_requires=[
'six', 'numpydoc', # 'numpy>=1.9.2',
],
keywords='optimization multidisciplinary multi-disciplinary analysis',
author='OpenMDAO Team',
author_email='[email protected]',
url='http://openmdao.org',
download_url='http://github.com/OpenMDAO/OpenMDAO/tarball/2.0.0',
license='Apache License, Version 2.0',
packages=[
'openmdao',
'openmdao.approximation_schemes',
'openmdao.code_review',
'openmdao.components',
'openmdao.core',
'openmdao.devtools',
'openmdao.devtools.problem_viewer',
'openmdao.docs',
'openmdao.drivers',
'openmdao.error_checking',
'openmdao.jacobians',
'openmdao.matrices',
'openmdao.proc_allocators',
'openmdao.recorders',
'openmdao.solvers',
'openmdao.solvers.linear',
'openmdao.solvers.linesearch',
'openmdao.solvers.nonlinear',
'openmdao.test_suite',
'openmdao.test_suite.components',
'openmdao.test_suite.groups',
'openmdao.test_suite.test_examples',
'openmdao.test_suite.test_examples.beam_optimization',
'openmdao.test_suite.test_examples.beam_optimization.components',
'openmdao.utils',
'openmdao.vectors',
'openmdao.surrogate_models',
'openmdao.surrogate_models.nn_interpolators'
],
package_data={
'openmdao.devtools': ['*.wpr', '*.html'],
'openmdao.devtools.problem_viewer': [
'visualization/libs/*.js',
'visualization/src/*.js',
'visualization/style/*.css',
'visualization/style/*.woff',
'visualization/*.html'
],
'openmdao.docs': ['*.py', '_utils/*.py'],
'openmdao.utils': ['unit_library.ini'],
'openmdao.test_suite': ['*.py', '*/*.py'],
'openmdao': ['*/tests/*.py', '*/*/tests/*.py', '*/*/*/tests/*.py']
},
install_requires=[
'six',
'numpydoc',
'scipy',
'sqlitedict',
'pycodestyle', 'pydocstyle',
'testflo',
'parameterized',
'pyparsing',
'networkx',
'sphinx',
'redbaron',
'mock',
'requests_mock',
'tornado',
],
# scripts=['bin/om-pylint.sh']
entry_points="""
[console_scripts]
wingproj=openmdao.devtools.wingproj:run_wing
webview=openmdao.devtools.webview:webview_argv
iprofview=openmdao.devtools.iprofile_app.iprofile_app:_prof_view
iproftotals=openmdao.devtools.iprofile:_prof_totals
iprofmem=openmdao.devtools.iprof_mem:_profile_py_file
icalltrace=openmdao.devtools.itrace:_trace_py_file
run_test=openmdao.devtools.run_test:run_test
"""
'tornado'
],
# scripts=['bin/om-pylint.sh']
entry_points="""
[console_scripts]
wingproj=openmdao.devtools.wingproj:run_wing
webview=openmdao.devtools.webview:webview_argv
iprofview=openmdao.devtools.iprofile_app.iprofile_app:_prof_view
iproftotals=openmdao.devtools.iprofile:_prof_totals
iprofmem=openmdao.devtools.iprof_mem:_profile_py_file
icalltrace=openmdao.devtools.itrace:_trace_py_file
run_test=openmdao.devtools.run_test:run_test
"""
)

0 comments on commit 6d4174a

Please sign in to comment.