Difference between revisions of "Philosophy of examples and how to run them"

From Medusa: Coordinate Free Mehless Method implementation
Jump to: navigation, search
Line 1: Line 1:
 
The essence of our examples is to present the functionality of the library in an accessible and digestible manner. The examples present different solutions to problems ranging in difficulty from the simple [[Poisson's equation]] to [[Fluid mechanics]]. Accompanying each example are Matlab scripts which were used to produce the figures the reader meets throughout this section, both the scripts and examples are made to work as is, so the reader can simply run the examples on their machine.
 
The essence of our examples is to present the functionality of the library in an accessible and digestible manner. The examples present different solutions to problems ranging in difficulty from the simple [[Poisson's equation]] to [[Fluid mechanics]]. Accompanying each example are Matlab scripts which were used to produce the figures the reader meets throughout this section, both the scripts and examples are made to work as is, so the reader can simply run the examples on their machine.
  
Out of source builds are preferred, the building is done in the build/ directory. When you are in the example folder you want to use, run
+
The building is done in the `build/` directory. When you are in the folder where your example is located, run
 
<syntaxhighlight>
 
<syntaxhighlight>
mkdir -p build
+
mkdir -p build # creates the directory build, of it does not exist
cd build
+
cd build       # goes to that directory
cmake ..
+
cmake ..       # creates Makefiles
make
+
make example    # builds your example         
 
</syntaxhighlight>
 
</syntaxhighlight>
 
+
to compile your example. Note that you only have to run cmake once, after that
to build all targets. Note that you only have to run cmake once, after that
+
only make is sufficient. Compiled binaries are placed into `bin/` folder and libraries are placed into `lib/`
only make is sufficient.
 
Binaries are placed into bin/ folder and libraries are placed into lib/
 
 
folder.
 
folder.
  
To build a single target you only need to run (after running cmake)
+
To build all examples target you can just run (after running cmake at least once)
 
<syntaxhighlight>
 
<syntaxhighlight>
make example
+
make all
 
</syntaxhighlight>
 
</syntaxhighlight>
  
To run the built example, go to bin/ and run
+
To run the built example, go back to the examples folder and run
 
<syntaxhighlight>
 
<syntaxhighlight>
./example
+
./bin/example
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
TODO: kje so outputi, kje so plot skripte...

Revision as of 14:48, 3 August 2018

The essence of our examples is to present the functionality of the library in an accessible and digestible manner. The examples present different solutions to problems ranging in difficulty from the simple Poisson's equation to Fluid mechanics. Accompanying each example are Matlab scripts which were used to produce the figures the reader meets throughout this section, both the scripts and examples are made to work as is, so the reader can simply run the examples on their machine.

The building is done in the `build/` directory. When you are in the folder where your example is located, run

mkdir -p build  # creates the directory build, of it does not exist
cd build        # goes to that directory
cmake ..        # creates Makefiles
make example    # builds your example

to compile your example. Note that you only have to run cmake once, after that only make is sufficient. Compiled binaries are placed into `bin/` folder and libraries are placed into `lib/` folder.

To build all examples target you can just run (after running cmake at least once)

make all

To run the built example, go back to the examples folder and run

./bin/example

TODO: kje so outputi, kje so plot skripte...