diff --git a/README.md b/README.md index dd15ac7..d5b19c1 100644 --- a/README.md +++ b/README.md @@ -1,82 +1,82 @@ # Dependencies ## Core FFTW3_OMP, swig3, python(2|3), numpy, g++ with C++14 support ## Doc Doxygen, Mercurial # Build ## First time building For the first build, you should compile Criterion, a library used for tests: git submodule update --init --recursive cd third-party/Criterion mkdir build cd build cmake .. cmake --build . - cd ../.. + cd ../../.. 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 For a list of all compilation options: scons -h 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. ## Build the doxygen scons build_doc=true # Coding ## Python Tamaas is mainly used through the python interface. An example can be found in `examples/new_contact.py` ## C++ TODO: update the example # Paralellism 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. diff --git a/README.org b/README.org deleted file mode 100644 index 75b6d63..0000000 --- a/README.org +++ /dev/null @@ -1,132 +0,0 @@ -#+TITLE: Welcome to Tamaas, the Rough surface toolkit of LSMS - -* Build -The build system uses SCons. In order to construct the library you should hit: - -#+BEGIN_SRC -scons -#+END_SRC - - -And to speedup the process you can do: - -#+BEGIN_SRC -scons -j 6 -#+END_SRC - -In order to clean the build - -#+BEGIN_SRC -scons -c -#+END_SRC - -In order to compile in debug - -#+BEGIN_SRC -scons build_type=debug -#+END_SRC - -Indeed the default was - -#+BEGIN_SRC -scons build_type=release -#+END_SRC - -In order to make the compilation more verbose - -#+BEGIN_SRC -scons verbose=true -#+END_SRC - -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 -** C++ -All classes and functions in Tamaas live in the `tamaas` namespace. Here is an example main: - -#+NAME: Example main -#+BEGIN_SRC c++ -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 & surface = sg.buildSurface(); - - // BEM object - BemPolonski bem(surface); - bem.setEffectiveModulus(1.); - - // Solving equilibrium - Real load = 0.01; - bem.computeEquilibrium(1e-12, load); - - Surface & tractions = bem.getTractions(); - Surface & displacements = bem.getDisplacements(); - - // Cleaning up tamaas - finalize(); -} -#+END_SRC - -** Python -Tamaas also has a python interface. Here is an example: - -#+NAME: Python example -#+BEGIN_SRC python -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() -#+END_SRC - -* Paralellism -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. diff --git a/tests/SConscript b/tests/SConscript index b02e9f8..edd1810 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -1,44 +1,46 @@ from __future__ import print_function from os.path import join, abspath Import('main_env') print("Environment for tests") test_env = main_env.Clone( - tools=[criterion], PRINT_CMD_LINE_FUNC=main_env['gen_print']("Copying", "red", main_env)) test_files = Split(""" run_tests.sh test_hertz_pressure.py test_westergaard.py test_patch_westergaard.py test_surface.py test_autocorrelation.py test_hertz_disp.py test_hertz_kato.py test_hertz_adhesion.py test_saturated_pressure.py test_fftransform.py test_bem_grid.py test_flood_fill.py """) src_dir = "#/tests" build_dir = 'build-' + main_env['build_type'] + '/tests' for file in test_files: source = join(src_dir, file) test_env.Command(file, source, Copy("$TARGET", "$SOURCE")) +crit_env = main_env.Clone(tools=[criterion]) +crit_env['CXXCOMSTR'] = main_env['SHCXXCOMSTR'] +crit_env['LINKCOMSTR'] = main_env['SHLINKCOMSTR'] -test_env.AppendUnique(LIBS=['Tamaas'], +crit_env.AppendUnique(LIBS=['Tamaas'], LIBPATH=[abspath('build-' + main_env['build_type'] + '/src')]) cpp_test_files = Split(""" test_grid.cpp """) for file in cpp_test_files: - test_env.Program(file) + crit_env.Program(file)