Ejemplo n.º 1
0
def main():
    pool = define_input()
    # Can define other default values in a file: --poolfile name
    from parampool.pool.UI import set_defaults_from_file
    pool = set_defaults_from_file(pool)
    # Can override default values on the command line
    from parampool.pool.UI import set_values_from_command_line
    pool = set_values_from_command_line(pool)

    s, s_unit = distance_unit(pool)
    print 's=%g' % s, s_unit
Ejemplo n.º 2
0
def main():
    pool = define_input()
    # Can define other default values in a file: --poolfile name
    from parampool.pool.UI import set_defaults_from_file
    pool = set_defaults_from_file(pool)
    # Can override default values on the command line
    from parampool.pool.UI import set_values_from_command_line
    pool = set_values_from_command_line(pool)

    s, s_unit = distance_unit(pool)
    print 's=%g' % s, s_unit
Ejemplo n.º 3
0
def main_table():
    """Make a table of s values based on multiple input of v_0, t, a."""
    pool = define_input()
    # Can define other default values in a file: --poolfile name
    from parampool.pool.UI import set_defaults_from_file
    pool = set_defaults_from_file(pool)
    # Can override default values on the command line
    from parampool.pool.UI import set_values_from_command_line
    pool = set_values_from_command_line(pool)

    table = distance_table(pool)
    print '|-----------------------------------------------------|'
    print '|      v_0   |      a     |      t     |      s       |'
    print '|-----------------------------------------------------|'
    for v_0, a, t, s in table:
        print '|%11.3f | %10.3f | %10.3f | %12.3f |' % (v_0, a, t, s)
    print '|-----------------------------------------------------|'
Ejemplo n.º 4
0
def main_table():
    """Make a table of s values based on multiple input of v_0, t, a."""
    pool = define_input()
    # Can define other default values in a file: --poolfile name
    from parampool.pool.UI import set_defaults_from_file
    pool = set_defaults_from_file(pool)
    # Can override default values on the command line
    from parampool.pool.UI import set_values_from_command_line
    pool = set_values_from_command_line(pool)

    table = distance_table(pool)
    print '|-----------------------------------------------------|'
    print '|      v_0   |      a     |      t     |      s       |'
    print '|-----------------------------------------------------|'
    for v_0, a, t, s in table:
        print '|%11.3f | %10.3f | %10.3f | %12.3f |' % (v_0, a, t, s)
    print '|-----------------------------------------------------|'
Ejemplo n.º 5
0
import os
from compute import compute as compute_function

# Pool object (must be imported before model)
from compute import define_pool as pool_function

pool = pool_function()

# Can define other default values in a file: --poolfile name
from parampool.pool.UI import set_defaults_from_file

pool = set_defaults_from_file(pool)
# Can override default values on the command line
from parampool.pool.UI import set_values_from_command_line

pool = set_values_from_command_line(pool)

from flask import Flask, render_template, request
from model import Compute

# Application object
app = Flask(__name__)


# Path to the web application
@app.route('/', methods=['GET', 'POST'])
def index():
    form = Compute(request.form)
    if request.method == 'POST':  # and form.validate():

        # Send data to Pool object
from compute import compute_motion_and_forces_with_pool as compute_function

# Pool object (must be imported before compute_motion_and_forces_with_pool_pool_definition_api_models
from compute import pool_definition_api as pool_function
pool = pool_function()

# Can define other default values in a file: --poolfile name
from parampool.pool.UI import set_defaults_from_file
pool = set_defaults_from_file(pool)
# Can override default values on the command line
from parampool.pool.UI import set_values_from_command_line
pool = set_values_from_command_line(pool)

from django.shortcuts import render_to_response
from django.template import RequestContext
from compute_motion_and_forces_with_pool_pool_definition_api_models import MotionAndForcesWithPool, MotionAndForcesWithPoolForm

def index(request):
    result = None

    form = MotionAndForcesWithPoolForm(request.POST or None)
    if request.method == 'POST' and form.is_valid():
        for field in form:
            name = MotionAndForcesWithPool._meta.get_field(field.name).verbose_name.strip()
            value = field.data
            pool.set_value(name, value)
        result = compute(pool)
        form = MotionAndForcesWithPoolForm(request.POST)

    return render_to_response(
        "compute_motion_and_forces_with_pool_pool_definition_api_index.html",