Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F64734772
README.md
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, May 29, 01:49
Size
3 KB
Mime Type
text/html
Expires
Fri, May 31, 01:49 (2 d)
Engine
blob
Format
Raw Data
Handle
17951538
Attached To
rTAMAAS tamaas
README.md
View Options
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1. Build</a></li>
<li><a href="#sec-2">2. Coding</a>
<ul>
<li><a href="#sec-2-1">2.1. C++</a></li>
<li><a href="#sec-2-2">2.2. Python</a></li>
</ul>
</li>
<li><a href="#sec-3">3. Paralellism</a></li>
</ul>
</div>
</div>
# Build<a id="sec-1" name="sec-1"></a>
The build system uses SCons. In order to construct the library you should hit:
scons
And to speedup the process you can do:
scons -j 6
In order to clean the build
scons -c
In order to compile in debug
scons build_type=debug
Indeed the default was
scons build_type=release
In order to make the compilation more verbose
scons verbose=true
You can customize a few compilation variables:
- `CXX` changes the compiler
- `CXXFLAGS` adds flags to the compilation process
For example:
- `scons CXX=icpc` compiles with the intel C++ compiler
- `CXXFLAGS=-mavx2 scons` adds the `-mavx2` flag (which enables some Intel instructions) to the compilation process
If the `CXX` variable is defined in your environment, `scons` will take it as a default compiler.
# Coding<a id="sec-2" name="sec-2"></a>
## C++<a id="sec-2-1" name="sec-2-1"></a>
All classes and functions in Tamaas live in the \`tamaas\` namespace. Here is an example main:
using namespace tamaas;
int main (int argc, char * argv[]) {
// Initializing tamaas
initialize();
// Surface parameters
const UInt grid_size = 1024;
const UInt k0 = 4, k1 = 4, k2 = 32;
const Real hurst = 0.8;
const Real rms = 0.1;
// Surface generator
SurfaceGeneratorFilterFFT sg;
sg.getGridSize() = grid_size;
sg.getQ0() = k0;
sg.getQ1() = k1;
sg.getQ2() = k2;
sg.getRMS() = rms;
sg.getHurst() = hurst;
sg.getRandomSeed() = 56;
sg.Init();
Surface<Real> & surface = sg.buildSurface();
// BEM object
BemPolonski bem(surface);
bem.setEffectiveModulus(1.);
// Solving equilibrium
Real load = 0.01;
bem.computeEquilibrium(1e-12, load);
Surface<Real> & tractions = bem.getTractions();
Surface<Real> & displacements = bem.getDisplacements();
// Cleaning up tamaas
finalize();
}
## Python<a id="sec-2-2" name="sec-2-2"></a>
Tamaas also has a python interface. Here is an example:
import numpy as np
import tamaas as tm
tm.initialize()
# Surface generation
SG = tm.SurfaceGeneratorFilterFFT()
SG.getGridSize().assign(512)
SG.getHurst().assign(0.8)
SG.getRMS().assign(1.);
SG.getQ0().assign(4);
SG.getQ1().assign(4);
SG.getQ2().assign(32);
SG.getRandomSeed().assign(156);
SG.Init()
surface = SG.buildSurface()
bem = tm.BemPolonski(surface)
bem.setEffectiveModulus(1.)
load = 0.01
bem.computeEquilibrium(1e-12, load)
tractions = bem.getTractions()
displacements = bem.getDisplacements()
tm.finalize()
# Paralellism<a id="sec-3" name="sec-3"></a>
Tamaas features shared-memory paralellism with OpenMP. The number of threads can be
controlled via the `OMP_NUM_THREADS` environment variable or the `omp_set_num_thread()`
function in the OpenMP API.
Event Timeline
Log In to Comment