Code Monkey home page Code Monkey logo

simput's Introduction

Simput

Goal

To provide a simple way to write input simpulation files.

Installation

$ npm install -g simput

Usage

After installing the package you will get one executable Simput with the following set of options:

$ Simput

  Usage: Simput [options]

  Options:

    -h, --help                    output usage information
    -V, --version                 output the version number

    -i, --input [file|directory]  Input file or directory
    -o, --output [directory]      Output directory to output to
    -t, --type [type]             Type of input

    -s, --silent                  Do not open the browser

    -c, --compile [directory]     Directory to compile files
    -m, --minify                  Minify compiled file

Examples

$ Simput -p

Starts a server and opens your web browser, showing a landing page with a choice of inputs which you can create.

Demos

There are a few supplied demos in the folder types, each have their own README.

  • vCard is the simplest example, with a single type of output.
  • oscillator is a bit more complex, because it derives from a real benchmarking application meant to exercise in-situ analyses on hpc systems.
  • pyfr and vera produce input files for real applications, and are realistically complex.

Development

$ git clone --recursive https://github.com/Kitware/simput.git
$ cd simput
$ npm install
$ npm run build
$ npm link
$ Simput

  Usage: Simput [options]

  Options:

    -h, --help                    output usage information
    -V, --version                 output the version number

    -i, --input [file|directory]  Input file or directory
    -o, --output [directory]      Output directory to output to
    -t, --type [type]             Type of input

    -s, --silent                  Do not open the browser

    -c, --compile [directory]     Directory to compile files
    -m, --minify                  Minify compiled file

Then to compile pyfr and open a development server which watches for another compile:

$ npm run type:pyfr
$ npm run dev

Creating a new simulation type

In a separate location create a folder for your type:

# Replace [mytype] with your type name.
mkdir [mytype]
cd [mytype]
git init

Create the folder and file structure:

  • /src
    • /lang
      • /[language] e.g. "en", "fr"
        • label.json, attribute and property labels.
        • /help, help dialogs, recommended, not required
          • /[folders for each attribute]
            • [file for each property, contents are html]
    • /templates
      • [template file and helpers]
    • model.js, primary data structure.
    • convert.js, converts the model into the simulation deck format.
    • parse.js, converts a complete input file to the simput model; recommended, not required.
  • /samples, empty or partially full sample datasets; recommended, not required.
  • /versions, an output folder for your compiled type; recommended, not required.
  • README.md, a description of your type; recommended, not required.

For examples of each take a look at types/demo

Optional: Add the type as a submodule to this repository

It's critical that these are executed in order

# start in the [mytype] directory from above. Replace [mytype] with your type name below.
git checkout -b type-[mytype] #replace 'mytype' with the name of the new type
git commit -m "initial commit"
git remote add origin https://github.com/Kitware/simput.git
git push origin type-[mytype] # where 'mytype-branch' is the current branch name
cd [your simput repo] # usually cd ../..
git submodule add -b type-[mytype] https://github.com/kitware/simput types/[mytype]
git add .gitmodules types/
git commit -m "added [mytype]"
git push

Add to compilation and landing page

Simput changed to a Vue.js framework, and no longer has the ability to dynamically add and load types - they must be present when Simput is built by webpack.

Add another script to package.json which compiles your type.

Add a call to Simput.registerType() for your type in static/index.html

This will likely change soon.

Licensing

Simput is licensed under BSD Clause 3.

Getting Involved

Fork our repository and do great things. At Kitware, we've been contributing to open-source software for 15 years and counting, and want to make Simput useful to as many people as possible.

simput's People

Contributors

aronhelser avatar bnmajor avatar dependabot[bot] avatar drewlazzerikitware avatar floryst avatar jourdain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simput's Issues

Layout '2' without defaults causes React warnings.

This UI spec in model.js:

        {
          id: 'restart_write',
          type: 'string',
          size: 2,
          layout: '2',
          //default: ['', ''],
          label: 'Restart Write',
        },

without the 'default' provided (as shown), causes React 16 to warn about 'null' provided as a value for inputs, and converting controlled to uncontrolled components.

Styling

β€’ make inputs bigger
β€’ isolate styles to specific components

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The push permission to the Git repository is required.

semantic-release cannot push the version tag to the branch master on remote Git repository with URL http://[secure]@github.com/kitware/simput.git.

Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment and make sure the repositoryUrl is configured with a valid Git URL.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Error running compiler

I installed simput and tried compiling a simple example. Got an error related to the node_modules path. Simput seems to be looking under its installed path instead of the project node_modules. Am I doing something wrong?

tortuga2:simput-protos john$ ./node_modules/.bin/Simput -c input -o output
Error building 

/Users/john/projects/resonant-hpc/git/simput-protos/node_modules/simput/src/cli/compile.js:246
        throw jsonStats.errors;
        ^
[
  "Entry module not found: Error: Can't resolve 'expose-loader' in '/Users/john/projects/resonant-hpc/git/simput-protos'\n" +
    "resolve 'expose-loader' in '/Users/john/projects/resonant-hpc/git/simput-protos'\n" +
    '  Parsed request is a module\n' +
    '  using description file: /Users/john/projects/resonant-hpc/git/simput-protos/package.json (relative path: .)\n' +
    '    resolve as module\n' +
    '      looking for modules in /Users/john/projects/resonant-hpc/git/simput-protos/node_modules/simput/node_modules\n' +
    '        using description file: /Users/john/projects/resonant-hpc/git/simput-protos/node_modules/simput/package.json (relative path: ./node_modules)\n' +
    '          using description file: /Users/john/projects/resonant-hpc/git/simput-protos/node_modules/simput/package.json (relative path: ./node_modules/expose-loader)\n' +
    '            no extension\n' +
    "              /Users/john/projects/resonant-hpc/git/simput-protos/node_modules/simput/node_modules/expose-loader doesn't exist\n" +
    '            .js\n' +
    "              /Users/john/projects/resonant-hpc/git/simput-protos/node_modules/simput/node_modules/expose-loader.js doesn't exist\n" +
    '            .json\n' +
    "              /Users/john/projects/resonant-hpc/git/simput-protos/node_modules/simput/node_modules/expose-loader.json doesn't exist\n" +
    '            as directory\n' +
    "              /Users/john/projects/resonant-hpc/git/simput-protos/node_modules/simput/node_modules/expose-loader doesn't exist"
]

FWIW, Simput did create index.js and convert.js in the input folder.

sem-release issue?

I've been having to manually release and publish to npm (the horror). Could be something out of date with sem-release?

Simput cli misbehaving

I used 'npm link' so the 'Simput' command would point to my local checkout. With the new Vue.js UI, if I do:

Simput or Simput -t oscillator

or if I do what is currently in the documentation, like for pyfr:

Simput -i samples/empty/pyfr-empty-externals.json -o samples/empty/

the app exits without output. I have to do:

Simput -t oscillator -i /tmp

for it to start.

@jourdain

importing file does not update active view

See attached gif, the parts where the mouse is invisible I'm choosing the file from the system (which screen capturers in chrome to not pick up). I upload a file where the Pr value is 72000 and I need to switch to another view and back to see the changes.

untitled gif

fail to save oscillator

Trying to follow the docs related to oscillator,
I've created an oscillator "osc1".
When trying to save the output with the "save" button, it gives me the following error:

Simput: 3.0.0
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0


[Vue warn]: Error in event handler for "click": "TypeError: dataModel.data.run[0] is undefined"

found in

---> <VBtn>
       <VToolbar>
         <VApp>
           <DragAndDrop> at src/components/widgets/DragAndDrop/index.vue
             <App> at src/components/core/App/index.vue
               <Root>,TypeError: dataModel.data.run[0] is undefined

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Enable new type registration dynamically

The new Vue.js UI is loading types statically using webpack. @jourdain says:

the thing that is not worked out yet is how to register your type like we do it here.
Knowing that those types could be hosted anywhere...

The simput cli no longer helps with this.

Import Simput into existing non-Vue.js project

We wish to use Simput as part of an existing project that does not use Vue.js (indeed, we don't have any experience of using Vue.js within our team). What we'd like is to re-direct our users directly to the settings specification page for our particular model (i.e., by-pass the Landing page). It's not clear to us what part of the code we need to modify in order to achieve this. Any help would be appreciated.

Note that we don't mind having the Simput part of our project implemented in Vue.js as is. We just can't figure out how to re-direct users directly to the settings page of a particular model.

Thank you.

more straight forward development usage

A watch command for types for quicker type development would be a good start.
My flow recently has been:

Simput -t pyfr -o versions/ -c src/ && Simput -a versions/pyfr.js && simput -o . -t pyfr

everytime I have a change in the types πŸ˜•

Multiple sections are not distinct enough from each other.

screen shot 2016-02-05 at 17 33 23

With some styling:
.prop-header {
    border-bottom: 4px solid #555; /* changed border width and color */
    width: 100%;
    padding: 10px 8px 3px;
    font-size: 1.1em;
    color: #111; /* changed color */
}

.InputBlock_header {
  color: #404040; /* changed color */
/* there are other attrs for this class but only color is changed */
}

We make the sections more distinct.
screen shot 2016-02-05 at 17 31 52

CSS that controls these props is in Tonic-UI and is used in a lot of places there. Need to isolate this.

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The push permission to the Git repository is required.

semantic-release cannot push the version tag to the branch master on remote Git repository.

Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Syntax error on `Simput -p`: unexpected token `(`

On a fresh npm install -g simput install, I get the following traceback:

$ Simput -p
/usr/local/lib/node_modules/simput/node_modules/serve-handler/src/index.js:178
const getHeaders = async (customHeaders = [], current, absolutePath, stats) => {
                         ^

SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/simput/src/cli/simput-cli.js:72:19)

System:

$ npm -v
6.11.3

$ node -v
v6.11.4

$ uname -rsm
Darwin 18.7.0 x86_64

no `-a` in `Simput`?

Unless, I'm wrong there is no -a in Simput

Could you explain or remove the comment about adding the compiled package to Simput:
Simput -a versions/openfoam_tutorials.js

View menu width

Adjusts too much on property selection or when editing a long title name.

min-width: some%;
max-width: some%;

add ellipses too for labels

Simput as a case manager

Hi,

I am trying to set up simput as a case manager. I just went through a simple vcard tutorial and the OpenFOAM ones and I am now adapting it for my own purposes.

With the vcard tutorial I noticed that deleting the entries in the "Address book" does not delete the corresponding .vcf files nor even the entries in the json file. Is that something I need to script myself? Is there a ready example for it?

Basically, I'd like to have a simple Web UI for a collection of templated OpenFOAM cases rather than for a single case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.