Git Product home page Git Product logo

tutorialstorage's Introduction

Hello, Cyclus!

This pages walks you through a very simple hello world example using agents. First make sure that you have the dependencies installed, namely , CMake, and a recent version of Python (2.7 or 3.3+).

First, you need to get the cycstub code. Cycstub is a skeleton code base that you can use to quick-start new module development projects. You can grab cycstub either by using git to clone the repository or by downloading the zip file. Let's put this code in a tutorial directory and go into it.

Getting cycstub via git:

$ git clone https://github.com/cyclus/cycstub.git tutorial
$ cd tutorial

Getting cycstub via zip:

$ curl -L https://api.github.com/repos/cyclus/cycstub/zipball > tutorial.zip
$ unzip tutorial.zip
$ mv cyclus-cycstub-* tutorial
$ cd tutorial

Since cycstub is a template project everything is named stub. We need to change this to reflect the name we want our new project to be called -tutorial here. Cycstub comes with a renaming tool to do just this! From the command line, run Python in the following way:

tutorial $ python rename.py tutorial

Let's now change the behavior of the TutorialFacility's Tick() & Tock() member functions to print "Hello" and "World" respectively. To do this, please open up the src/tutorial_facility.cc file in your favorite text editor (vim, emacs, gedit, notepad++). Change the original functions to look like:

Original Tick() and Tock() in src/tutorial_facility.cc:

New Tick() and Tock() in src/tutorial_facility.cc:


Now that we have altered the behavior of the TutorialFacility, let's compile and install the tutorial project. This done with the install.py script. The install script puts the project into your cyclus userspace, ${HOME}/.local/lib/cyclus.

tutorial $ python install.py

Let's run with the TutorialFacility! In the input directory there is an example.xml. Running on this file with the command cyclus input/example.xml should produce the following output.

tutorial $ cyclus input/example.xml
              :
          .CL:CC CC             _Q     _Q  _Q_Q    _Q    _Q              _Q
        CC;CCCCCCCC:C;         /_\)   /_\)/_/\\)  /_\)  /_\)            /_\)
        CCCCCCCCCCCCCl       __O|/O___O|/O_OO|/O__O|/O__O|/O____________O|/O__
     CCCCCCf     iCCCLCC     /////////////////////////////////////////////////
     iCCCt  ;;;;;.  CCCC
    CCCC  ;;;;;;;;;. CClL.                          c
   CCCC ,;;       ;;: CCCC  ;                   : CCCCi
    CCC ;;         ;;  CC   ;;:                CCC`   `C;
  lCCC ;;              CCCC  ;;;:             :CC .;;. C;   ;    :   ;  :;;
  CCCC ;.              CCCC    ;;;,           CC ;    ; Ci  ;    :   ;  :  ;
   iCC :;               CC       ;;;,        ;C ;       CC  ;    :   ; .
  CCCi ;;               CCC        ;;;.      .C ;       tf  ;    :   ;  ;.
  CCC  ;;               CCC          ;;;;;;; fC :       lC  ;    :   ;    ;:
   iCf ;;               CC         :;;:      tC ;       CC  ;    :   ;     ;
  fCCC :;              LCCf      ;;;:         LC :.  ,: C   ;    ;   ; ;   ;
  CCCC  ;;             CCCC    ;;;:           CCi `;;` CC.  ;;;; :;.;.  ; ,;
    CCl ;;             CC    ;;;;              CCC    CCL
   tCCC  ;;        ;; CCCL  ;;;                  tCCCCC.
    CCCC  ;;     :;; CCCCf  ;                     ,L
     lCCC   ;;;;;;  CCCL
     CCCCCC  :;;  fCCCCC
      . CCCC     CCCC .
       .CCCCCCCCCCCCCi
          iCCCCCLCf
           .  C. ,
              :
Hello, World!
Hello, World!
Hello, World!
Hello, World!
Hello, World!
Hello, World!
Hello, World!
Hello, World!
Hello, World!
Hello, World!

Status: Cyclus run successful!
Output location: cyclus.sqlite
Simulation ID: 0ae730e0-a9a8-4576-afaa-d1db6399d5a2

If you look in the input file you'll see that the simulation duration was set to 10. This is why "Hello, World!" is printed ten times.

tutorialstorage's People

Contributors

gidden avatar gonuke avatar jlittell avatar katyhuff avatar rakhimov avatar rwcarlsen avatar scopatz avatar

Watchers

 avatar  avatar

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.