diff --git a/2D_DDD_simulation.vcxproj b/2D_DDD_simulation.vcxproj
new file mode 100644
index 0000000..825d8e6
--- /dev/null
+++ b/2D_DDD_simulation.vcxproj
@@ -0,0 +1,81 @@
+
+
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ {75A81D91-0A37-4267-B130-851C16A59F5E}
+ Win32Proj
+ 2D_DDD_simulation
+
+
+
+ Application
+ true
+ v142
+
+
+ Application
+ false
+ v142
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %VCPKG_ROOT%\packages\suitesparse_x64-windows\include\suitesparse;include;$(IncludePath)
+
+
+ %VCPKG_ROOT%\packages\suitesparse_x64-windows\include\suitesparse;include;$(IncludePath)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/2D_DDD_simulation.vcxproj.filters b/2D_DDD_simulation.vcxproj.filters
new file mode 100644
index 0000000..a35c3bf
--- /dev/null
+++ b/2D_DDD_simulation.vcxproj.filters
@@ -0,0 +1,90 @@
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Resource Files
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+
+
+
+ {6013aefb-16fa-4271-98ac-dde3f86dde21}
+
+
+ {64edc90b-102e-42e6-a58f-608780a2886c}
+
+
+ {6834fa22-3c32-484d-8c46-ddd1aaf96a40}
+
+
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f468926..f773a0c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,6 +86,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # is required
# Find required packages
+
find_package(PythonLibs ${PY_VERSION})
if(PYTHON_FOUND)
include_directories(${PYTHON_INCLUDE_DIR})
@@ -94,7 +95,6 @@ endif()
find_package(FFTW REQUIRED DOUBLE_LIB)
include_directories(FFTW_INCLUDE_DIRS)
-
FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
if(Boost_FOUND)
# with SYSTEM the compiler knows that they aren't our headers thus
@@ -106,12 +106,18 @@ endif()
set(Boost_FOUND FALSE)
if (BUILD_PYTHON_BINDINGS)
- FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} COMPONENTS system python3)
- if(Boost_FOUND)
- # with SYSTEM the compiler knows that they aren't our headers thus
- # warnings & co. will be omitted
- include_directories(SYSTEM ${Boost_INCLUDE_DIR})
- set(BOOST_PYTHON_LIBRARIES ${Boost_LIBRARIES})
+ FIND_PACKAGE(PythonLibs ${PY_VERSION} REQUIRED)
+ if(PYTHONLIBS_FOUND)
+ include_directories(${PYTHON_INCLUDE_DIR})
+ FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} COMPONENTS system python3)
+ if(Boost_FOUND)
+ # with SYSTEM the compiler knows that they aren't our headers thus
+ # warnings & co. will be omitted
+ include_directories(SYSTEM ${Boost_INCLUDE_DIR})
+ set(BOOST_PYTHON_LIBRARIES ${Boost_LIBRARIES})
+ else()
+ set(BUILD_PYTHON_BINDINGS FALSE)
+ endif()
else()
set(BUILD_PYTHON_BINDINGS FALSE)
endif()
diff --git a/README.md b/README.md
index d99f54a..724a768 100644
--- a/README.md
+++ b/README.md
@@ -2,23 +2,37 @@
Simple Discrete Dislocation Dynamics Simulation Toolkit
## Short description
-This toolkit makes it possible to easily simulate 2D edge dislocation systems where the slip planes are parallel and periodic boundary conditions are applied. The integrator is based on an implicit numerical scheme which makes it possible to keep the
-O(N2) complexity which arise from the pair interactions while no dislocation annihilation is required and the runtime is greatly decreased.
+This toolkit contains tools to simulate 2D single slip edge dislocation systems under periodic boundary conditions. The integrator is based on an implicit numerical scheme which makes it possible to keep the
+O(*N*2) complexity which arise from the pair interactions while no dislocation annihilation is required and the runtime is greatly decreased.
SDDDST is highly modular, it can be easily modified and extended based on the use case where it is needed.
The detailed publication of the numerical scheme and the implementation with the achived results will be soon available.
+### Tools
+The toolkit contains the following tools
+1. The **simulation program** *2D_DDD_simulation* that evols the dislocation configuration under the prescribed external stress.
+2. [**Dislocation system generator** *init_config_gen*](https://github.com/danieltuzes/sdddst/init_config_gen) to create the initial configuration.
+3. **Evaulation programs** to do perform analysis on the simulations obatined.
+
+The rest of this file belongs to the simulation program 2D_DDD_simulation.
+
## Build & run
-### Dependencies
-In order to be able to build the simulator, you will need the following dependencies on your computer:
+This project uses several external libraries, such as **umfpack** and **boost** and furthermore, to keep the code simple, some additional include libraries must be set up for your compiler. A convenient Linux-gcc-cmake built procedure (scenario A) is provided along with a Windows-VS-vcpkg built procedure (scenario B).
+
+### Dependencies: scenario A
+This is the Linux-gcc-cmake case. To be able to build the simulator, you will need the following dependencies on your computer:
* g++ or clang
-* cmake
+* cmake (at least version 3.8)
* make
-* boost
+* pyhton3 with python3-dev
+ * this is only needed if python interface is required in `CMakeLists.txt`
+ * this can be found at line 23: `option(BUILD_PYTHON_BINDINGS "Build python interface package" OFF)`
+ * a system-wide installation is required by default, otherwise, cmake will not find the libs
+ * using a local (user) version of python is also possible: define paths for cmake with the switch `-DPYTHON_LIBRARY=~/.local/lib/libpython` and `-DPYTHON_INCLUDE_DIR=~/.local/include/python3.7m` if you installed python3-dev into your `$HOME/.local` directory
* umfpack from suitesparse
-* gsl
+* boost (the program options, and python libraries, if python is required)
* FFTW
The build is fairly simple from the root directory of the source:
@@ -35,14 +49,41 @@ The resulting binary which can be used to run the simulations:
```bash
build/src/sdddst
```
-
+You can safely **delete** the files corresponding to scenario B:
+* 2D_DDD_simulation.vcxproj
+* 2D_DDD_simulation.vcxproj.filters
+* 2D_DDD_simulation.vcxproj.user
+* SDDST.sln
+
+### Dependencies: scenario B
+This is the Windows-VS-vcpkg case. The project can be compiled for x64 compatible machines only [due to umfpacks's openblas dependency](https://github.com/microsoft/vcpkg/issues/2095), which is available only for x64. This case comes with no python interface yet. Follow these instructions to be able build this project.
+1. Install [vcpkg](https://github.com/microsoft/vcpkg)
+ 1. Open a PowerShell (abbreviated as PS) and first create the directory where you would like to place it. Let's say, `C:\local`, so in PS, execute `mkdir C:\local`. Move there by executing `cd C:\local`.
+ 2. Download the vcpkg package with git or by downloading it with a browser from [its website](https://github.com/Microsoft/vcpkg).
+ 3. Extract the files with their parent folder vcpkg-master from the compressed file vcpkg-master.zip. Move it to `C:\local`. Navigate your PS there by `cd vcpkg-master`.
+ 3. Install the program by executing `.\bootstrap-vcpkg.bat`. The installar may ask for admin privileges.
+ 4. To use the installed packages automatically, execute `.\vcpkg integrate install`.
+2. Install the required dependencies with *vcpkg* by executing
+
+ 1. `.\vcpkg install boost-program-options:x64-windows` for boost program options, and
+ 2. `.\vcpkg install suitesparse:x64-windows`, this installs the umfpack.
+
+ These steps may take at least around 10 minutes.
+3. Use the solution file or set up a new one for the project. Due to an [issue](https://github.com/microsoft/vcpkg/issues/3417), your compiler probably need be informed about umpack's directory.
+ 1. With the provided solution the project files, it has been already added by pointing to `%VCPKG_ROOT%`. All you need to do is to add a system variable called VCPKG_ROOT with value pointing to the root directory of vcpkg. In our previous example, it was `C:\local\vcpkg-master`.
+ 2. If you do not want to or cannot create the system variable, or want to start your solution and project files from zero, you can manually add it to your project settings. Open project 2D_DDD_simulation in the solution SDDST, then open your project properties under Project, \ properties. Go to VC++ Directories and in the Include Directories add `C:\local\vcpkg-master\packages\suitesparse_x64-windows\include\suitesparse`.
+
+You can safely **delete** building files and folders for scenario A:
+* cmake/
+* CMakeLists.txt
+* sdddstCMakeConfig.h.in
+### Configuration files
For the available parameters, check out the help!
```bash
./sdddst --help
```
-### Configuration files
To be able to run a simulation, data has to be provided in plain text format. The slip planes of the dislocations are parallel with the x axis and the simulation area is between [-0.5, 0.5] in both directions. Based on that an example configuration file which contains dislocation data:
```
@@ -75,7 +116,7 @@ If a log file is requested, a file will be continously updated during the simula
* value of the external stress
* computation time between the last two successful steps
* accumulated strain
-* average v2
+* average *v*2
* energy of the system
### Cutoff multiplier
diff --git a/SDDST.sln b/SDDST.sln
new file mode 100644
index 0000000..c919027
--- /dev/null
+++ b/SDDST.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28803.156
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2D_DDD_simulation", "2D_DDD_simulation.vcxproj", "{75A81D91-0A37-4267-B130-851C16A59F5E}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "init_config_gen", "init_config_gen\init_config_gen.vcxproj", "{4234E9E2-9233-443B-A8DC-B66EDD59BBFD}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {75A81D91-0A37-4267-B130-851C16A59F5E}.Debug|x64.ActiveCfg = Debug|x64
+ {75A81D91-0A37-4267-B130-851C16A59F5E}.Debug|x64.Build.0 = Debug|x64
+ {75A81D91-0A37-4267-B130-851C16A59F5E}.Release|x64.ActiveCfg = Release|x64
+ {75A81D91-0A37-4267-B130-851C16A59F5E}.Release|x64.Build.0 = Release|x64
+ {4234E9E2-9233-443B-A8DC-B66EDD59BBFD}.Debug|x64.ActiveCfg = Debug|x64
+ {4234E9E2-9233-443B-A8DC-B66EDD59BBFD}.Debug|x64.Build.0 = Debug|x64
+ {4234E9E2-9233-443B-A8DC-B66EDD59BBFD}.Release|x64.ActiveCfg = Release|x64
+ {4234E9E2-9233-443B-A8DC-B66EDD59BBFD}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {1160B3E2-E24B-4F5E-9924-2AA7FD6AB9C0}
+ EndGlobalSection
+EndGlobal
diff --git a/include/Fields/AnalyticField.h b/include/Fields/AnalyticField.h
index 8a8658a..575a039 100644
--- a/include/Fields/AnalyticField.h
+++ b/include/Fields/AnalyticField.h
@@ -23,7 +23,8 @@
#include "Fields/Field.h"
#include "constants.h"
-#include
+#define _USE_MATH_DEFINES
+#include
namespace sdddstCore {
diff --git a/include/Fields/PeriodicShearStressELTE.h b/include/Fields/PeriodicShearStressELTE.h
index fdae996..51cc5f1 100644
--- a/include/Fields/PeriodicShearStressELTE.h
+++ b/include/Fields/PeriodicShearStressELTE.h
@@ -34,7 +34,7 @@
#include
#include
-#include
+//#include
#include "Fields/Field.h"
diff --git a/include/utility.h b/include/utility.h
index 2ce9188..c6e194c 100644
--- a/include/utility.h
+++ b/include/utility.h
@@ -20,9 +20,10 @@
#ifndef SDDDST_CORE_UTILITY_H
#define SDDDST_CORE_UTILITY_H
-#include
-#include
-#include
+#define _USE_MATH_DEFINES
+#include
+#include
+#include
inline void normalize(double &n)
{
@@ -72,19 +73,17 @@ inline double E_dx(const double & x, const double & y, const double & K)
// https://stackoverflow.com/questions/17432502/how-can-i-measure-cpu-time-and-wall-clock-time-on-both-linux-windows
inline double get_wall_time()
{
- struct timeval time;
- if (gettimeofday(&time, NULL)){
- // Handle error
- return 0;
- }
- return (double)time.tv_sec + (double)time.tv_usec * .000001;
+ auto t_start = std::chrono::high_resolution_clock::now();
+ auto t_start_ms = std::chrono::time_point_cast(t_start);
+ auto t_start_se = t_start_ms.time_since_epoch();
+
+ double time_in_ms = static_cast(t_start_se.count());
+
+ return time_in_ms / 1000.;
}
// From:
// https://stackoverflow.com/questions/17432502/how-can-i-measure-cpu-time-and-wall-clock-time-on-both-linux-windows
-inline double get_cpu_time()
-{
- return (double)clock() / CLOCKS_PER_SEC;
-}
+
#endif
diff --git a/init_config_gen/README.md b/init_config_gen/README.md
new file mode 100644
index 0000000..0c304e3
--- /dev/null
+++ b/init_config_gen/README.md
@@ -0,0 +1,27 @@
+# SDDDST::init_config_gen
+The initial configuration generator tool for Simple Discrete Dislocation Dynamics Simulation Toolkit
+
+## Short description
+With this tool one can create dislocation configurations to use as an input of the simulation program 2D_DDD_simulation. It uses a platform independent implementation provided by [`boost.random`](https://www.boost.org/doc/libs/1_70_0/doc/html/boost_random.html).
+
+## Dependencies
+There is 1 new dependency: [`boost.random`](https://www.boost.org/doc/libs/1_70_0/doc/html/boost_random.html). To compile this project you need boost's program options and random libraries. The first is already a requirement for the project *2D_DDD_simulation*.
+
+## Usage
+Type `init_config_gen --help` to get the help. The program accepts the following arguments:
+* `--N arg` or `-N arg`: **mandatory** argument. The number of dislocations to simulate. Must be an even number, because the same amount of positive and negative dislocations must be found in the system.
+* `--seed-start arg` or `-S arg`: optional argument with default value `1000`. It is an integer used to populate the seed value of the random number generator engine.
+* `--seed-end arg` or `-E arg`: optional argument. If set, must be larger than `seed_start` and the program will create configuration files starting from seed value `seed-start`, increasing it one by one till it reaches `seed-end` (closed interval).
+* `--unsorted` or `-U`: optional switch. If set, dislocations will not printed out in order starting with positive Burger's vector and highest value in y, but with alternating Burger's vector and uncorrelated x and y coordinates.
+* `--bare` or `-B`: optional swtich. If set, the configuration file name will not conatin the number of dislocations.
+
+## Output
+The program creates the initial conditions in the folder `dislocation-configurations` relative to the binary, with filenames `ic_SEEDVALUE_N.txt`. The file format is as described in [SDSST](https://github.com/danieltuzes/sdddst). The output is a simple text file in the format
+```
+pos_1_x pos_1_y Burgers_vector_1
+pos_2_x pos_2_y Burgers_vector_2
+...
+pos_N_x pos_N_y Burgers_vector_N
+
+```
+If the default value of parameter `sorted` is kept `true`, then dislocations with positive Burger's vector come first with decreasing y coordinate. If `false` is set, dislocations comes with alternating Burger's vector and random coordinate values. Please keep in mind that line endings (`CR` and `LF`) will depend on your operating system.
\ No newline at end of file
diff --git a/init_config_gen/init_config_gen.cpp b/init_config_gen/init_config_gen.cpp
new file mode 100644
index 0000000..9825d21
--- /dev/null
+++ b/init_config_gen/init_config_gen.cpp
@@ -0,0 +1,129 @@
+
+// init_config_gen.cpp : This file contains the 'main' function. Program execution begins and ends there.
+
+
+
+#include // to read in program call arguments
+#include // to add descriptions of the program call arguments
+#include // random number generator
+#include // uniform distribution generator
+
+#include
+#include
+#include
+#include
+
+namespace bpo = boost::program_options;
+namespace br = boost::random;
+int main(int argc, char** argv)
+{
+#pragma region read in variables
+ std::cout << 1 + 1;
+ bpo::options_description requiredOptions("Required options"); // must be set from command line or file
+ bpo::options_description optionalOptions("Optional options"); // must be set from command line or file
+
+ requiredOptions.add_options()
+ ("N,N", bpo::value(), "The number of dislocations to generate. Must be even, because N/2 number of positive and negative dislocations will be created.");
+
+ optionalOptions.add_options()
+ ("seed-start,S", bpo::value()->default_value(1000), "An integer used as an initial seed value for the random number generator.")
+ ("seed-end,E", bpo::value(), "An integer used as the last seed value for the random number generator, seed-end > seed_start must hold. If set, seed-end - seed-start number of initial configurations will be created.")
+ ("unsorted,U", "If set, dislocations will not printed out in order starting with positive Burger's vector and highest value in y, but with alternating Burger's vector and uncorrelated x and y coordinates.")
+ ("bare,B", "If set, filenames will not contain the value of the parameter N.")
+ ;
+
+ bpo::options_description options; // the superior container of the options
+
+ options.add(requiredOptions).add(optionalOptions).add_options()
+ ("help", "show this help")
+ ("hide-copyright,c", "hides the copyright notice from the standard output");
+
+ bpo::variables_map vm; // the storage for the variables
+
+ try {
+ bpo::store(bpo::parse_command_line(argc, argv, options), vm, false);
+ }
+ catch (bpo::error & e)
+ {
+ std::cerr << e.what() << std::endl;
+ exit(-1);
+ }
+
+ if (!vm.count("hide-copyright"))
+ {
+ std::cout << "init_config_gen from the SDDDST - Simple Discrete Dislocation Dynamics Toolkit\n"
+ "Copyright (C) 2015-2019 Gábor Péterffy , Dániel Tüzes and their friends.\n"
+ "This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; see the license for details\n";
+ }
+#pragma endregion
+
+#pragma region process variables
+ if (vm.count("help")) // if the user is curious
+ {
+ std::cout << options << std::endl;
+ exit(0);
+ }
+ else // real process is needed
+ {
+ // N
+ if (0 == vm.count("N")) // to test if N is present
+ {
+ std::cerr << "N is missing! Program terminates.\n";
+ exit(-1);
+ }
+ if (vm["N"].as() % 2 != 0) // to test if N is even
+ {
+ std::cerr << "N must be even. Program terminates." << std::endl;
+ exit(-1);
+ }
+
+ // seed-end >? seed-start
+ if (vm.count("seed-end") != 0 && vm["seed-end"].as() <= vm["seed-start"].as())
+ {
+ std::cerr << "seed-end >= seed-start must hold. Program terminates." << std::endl;
+ exit(-1);
+ }
+ if (vm.count("seed-end") == 0) // label: seed-end set
+ {
+ vm.insert(std::make_pair("seed-end", bpo::variable_value()));
+ }
+ vm.at("seed-end").value() = vm["seed-start"].as();
+ }
+#pragma endregion
+
+#pragma region generate and write out configuration
+ for (int seed_val = vm["seed-start"].as(); seed_val <= vm["seed-end"].as(); ++seed_val) // generate configurations with seeds in the range of [seed-start; seed-end]; seed-end has been set at label: seed-end set
+ {
+ std::string ofname = "dislocation-configurations/ic_" + std::to_string(seed_val);
+ if(vm.count("bare") == 0)
+ ofname += "_" + std::to_string(vm["N"].as());
+ ofname += ".txt"; // output filename; the file is inside a folder
+
+ std::ofstream ofile(ofname); // the filestream
+ if (!ofile) // evaluates to false if file cannot be opened
+ {
+ std::cerr << "Cannot write " << ofname << ". Program terminates." << std::endl;
+ exit(-1);
+ }
+ std::cout << "Generating configuration with seed value " << seed_val << "." << std::endl;
+ ofile.precision(std::numeric_limits::max_digits10); // print out every digits
+
+ br::mt19937 engine(seed_val); // Mersenne twister is a good and expensive random number generator
+ br::uniform_real_distribution<> distr(-0.5, 0.5); // uniform distribution on [-0.5; 0.5)
+ using disl = std::tuple; // a dislocation is a (double, double, int) tuple
+ std::vector dislocs; // container of the N number of dislocations
+
+ for (int n = 0; n < vm["N"].as(); ++n) // generate the N number of dislocations
+ dislocs.push_back(disl(distr(engine), distr(engine), (n % 2) * 2 - 1)); // x, y coordinates, and the Burger's vector
+
+ if (vm.count("unsorted") == 0) // sorting if not told otherwise
+ std::sort(dislocs.begin(), dislocs.end(), [](const disl& a, const disl& b) {return (std::get<1>(a) + std::get<2>(a)) > (std::get<1>(b) + std::get<2>(b)); });
+
+ for_each(dislocs.begin(), dislocs.end(), [&ofile](const disl& a) {ofile << std::get<0>(a) << "\t" << std::get<1>(a) << "\t" << std::get<2>(a) << "\n"; }); // print out to ofile
+ }
+#pragma endregion
+
+
+ std::cout << "Done.\n";
+ return 0;
+}
\ No newline at end of file
diff --git a/init_config_gen/init_config_gen.vcxproj b/init_config_gen/init_config_gen.vcxproj
new file mode 100644
index 0000000..350a44c
--- /dev/null
+++ b/init_config_gen/init_config_gen.vcxproj
@@ -0,0 +1,95 @@
+
+
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ {4234E9E2-9233-443B-A8DC-B66EDD59BBFD}
+ Win32Proj
+ initconfiggen
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ false
+
+
+
+
+
+ Level3
+ Disabled
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/init_config_gen/init_config_gen.vcxproj.filters b/init_config_gen/init_config_gen.vcxproj.filters
new file mode 100644
index 0000000..6c642da
--- /dev/null
+++ b/init_config_gen/init_config_gen.vcxproj.filters
@@ -0,0 +1,25 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Source Files
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Fields/PeriodicShearStressELTE.cpp b/src/Fields/PeriodicShearStressELTE.cpp
index 55c4600..44843a0 100644
--- a/src/Fields/PeriodicShearStressELTE.cpp
+++ b/src/Fields/PeriodicShearStressELTE.cpp
@@ -1,6 +1,6 @@
/*
* SDDDST Simple Discrete Dislocation Dynamics Toolkit
- * Copyright (C) 2015-2019 Gábor Péterffy
+ * Copyright (C) 2015-2019 Gábor Péterffy , Dániel Tüzes and their friends.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -121,7 +121,7 @@ void PeriodicShearStressELTE::loadStress(std::string path, const char *str, int
for(unsigned int i=0; i
+ * Copyright (C) 2015-2019 Gábor Péterffy , Dániel Tüzes and their friends.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,77 +26,76 @@
#include
-sdddstCore::ProjectParser::ProjectParser(int argc, char **argv):
+sdddstCore::ProjectParser::ProjectParser(int argc, char** argv) :
sD(nullptr)
{
- boost::program_options::options_description requiredOptions("Required Options");
- boost::program_options::options_description optionalOptions("Optional Options");
- boost::program_options::options_description fieldOptions("Available dislocation fields");
- boost::program_options::options_description externalStressProtocolOptions("External stress protocols (optional)");
+ boost::program_options::options_description requiredOptions("Required Options"); // must be set from command line or file
+ boost::program_options::options_description optionalOptions("Optional Options"); // either has value or program runs without them
+ boost::program_options::options_description fieldOptions("Available dislocation fields"); // how the interaction force should be calculated: lookup table or calculation
+ boost::program_options::options_description externalStressProtocolOptions("External stress protocols (optional)"); // how the external stress should increase
requiredOptions.add_options()
- ("dislocation-configuration", boost::program_options::value(), "plain text file path containing dislocation data in {x y b} triplets")
- ("result-dislocation-configuration", boost::program_options::value(), "path where the result configuration will be stored at the end of the simulation")
- ;
+ ("dislocation-configuration,I", boost::program_options::value(), "plain text file path containing dislocation data in (x y b) triplets")
+ ("result-dislocation-configuration,O", boost::program_options::value(), "path where the result configuration will be stored at the end of the simulation")
+ ;
optionalOptions.add_options()
- ("point-defect-configuration", boost::program_options::value(), "plain text file path containing point defect data in {x y} pairs")
- ("logfile-path", boost::program_options::value(), "path for the plain text log file (it will be overwritten if it already exists)")
- ("time-limit", boost::program_options::value(), "in simulation time limit, if reached the simulation stops")
- ("step-count-limit", boost::program_options::value(), "the simulation will stop after successful N steps")
- ("strain-increase-limit", boost::program_options::value(), "the simulation will stop after arg total strain increase is reached")
- ("avalanche-detection-limit", boost::program_options::value(), "the simulation will stop after the threshold was reached with the given numer of events from above")
- ("avalanche-speed-threshold", boost::program_options::value()->default_value(1e-3), "speed threshold for counting avalanches")
- ("initial-stepsize", boost::program_options::value()->default_value(1e-6), "first tried step size for the simulation")
- ("cutoff-multiplier", boost::program_options::value()->default_value(1e20), "multiplier of the 1/sqrt(N) cutoff parameter")
- ("max-stepsize", boost::program_options::value(), "the stepsize can not overleap this value")
- ("calculate-strain", "turns on strain calculation for the simulation")
- ("calculate-order-parameter", "turns on order parameter calculation during the simulation")
- ("position-precision", boost::program_options::value()->default_value(1e-5), "minimum precision for the positions for the adaptive step size protocol")
- ("save-sub-configurations", boost::program_options::value(), "saves the current configuration after every N successful step to the given destination")
- ("sub-configuration-delay", boost::program_options::value()->default_value(5), "number of successful steps between the sub configurations written out")
- ("sub-configuration-delay-during-avalanche", boost::program_options::value()->default_value(1), "number of successful steps between the sub configurations written out during avalanche if avalanche detection is on")
- ("change-cutoff-to-inf-under-threshold", boost::program_options::value(), "if the avg speed decreases once under this threshold during the simulation the applied cutoff multiplier will be 1e20")
- ;
+ ("point-defect-configuration", boost::program_options::value(), "plain text file path containing point defect data in (x y) pairs")
+ ("logfile-path,L", boost::program_options::value(), "path for the plain text log file (it will be overwritten if it already exists)")
+ ("time-limit,t", boost::program_options::value(), "the simulation stops if simulation time reached this limit")
+ ("step-count-limit,C", boost::program_options::value(), "the simulation will stop after successful N=SCL steps")
+ ("strain-increase-limit", boost::program_options::value(), "the simulation will stop after arg total strain increase is reached")
+ ("avalanche-detection-limit", boost::program_options::value(), "the simulation will stop after the threshold was reached with the given numer of events from above")
+ ("avalanche-speed-threshold", boost::program_options::value()->default_value(1e-3), "speed threshold for counting avalanches")
+ ("initial-stepsize", boost::program_options::value()->default_value(1e-6), "first tried step size for the simulation")
+ ("cutoff-multiplier,c", boost::program_options::value()->default_value(1e20), "multiplier of the 1/sqrt(N) cutoff parameter")
+ ("max-stepsize,M", boost::program_options::value(), "the stepsize can not overleap this value")
+ ("calculate-strain,S", "turns on strain calculation for the simulation")
+ ("calculate-order-parameter,l", "turns on order parameter calculation during the simulation")
+ ("position-precision,P", boost::program_options::value()->default_value(1e-5), "minimum precision for the positions for the adaptive step size protocol")
+ ("save-sub-configurations,o", boost::program_options::value(), "saves the current configuration after every N=SCD successful step to the given destination")
+ ("sub-configuration-delay,N", boost::program_options::value()->default_value(5), "number of successful steps between the sub configurations written out")
+ ("sub-configuration-delay-during-avalanche,n", boost::program_options::value()->default_value(1), "number of successful steps between the sub configurations written out during avalanche if avalanche detection is on")
+ ;
fieldOptions.add_options()
- ("periodic-stress-field-elte", boost::program_options::value(), "periodic stress field based on ELTE library, the arg should be the path to the binary data")
- ("periodic-stress-field-analytic", ("analytic periodic stress field (default), number of images in each direction: " + std::to_string(ANALYTIC_FIELD_N)).c_str())
- ;
+ ("periodic-stress-field-elte,p", boost::program_options::value(), "periodic stress field based on ELTE library, the argument should be the folder where the compressed numerical data can be found (default)")
+ ("periodic-stress-field-analytic,m", ("analytic periodic stress field (default), number of images in each direction: " + std::to_string(ANALYTIC_FIELD_N)).c_str())
+ ;
externalStressProtocolOptions.add_options()
- ("no-external-stress", "no external stress during the simulation (default)")
- ("fixed-rate-external-stress", boost::program_options::value(), "external stress is linear with time, rate should be specified as an arg")
- ("spring-constant", boost::program_options::value(), "simple model of an experiment where a spring is used, the arg should be the spring constant (it is valid only with the previous option together)")
- ;
+ ("no-external-stress,s", "no external stress during the simulation (default)")
+ ("fixed-rate-external-stress,f", boost::program_options::value(), "external stress is linear with time, rate should be specified as an arg")
+ ("spring-constant", boost::program_options::value(), "simple model of an experiment where a spring is used, the arg should be the spring constant (it is valid only with the previous option together)")
+ ;
boost::program_options::options_description options;
options.add(requiredOptions).add(optionalOptions).add(fieldOptions).add(externalStressProtocolOptions).add_options()
- ("help", "show this help")
- ("hide-copyright,c", "hides the copyright notice from the standard output");
+ ("help", "show this help")
+ ("hide-copyright,c", "hides the copyright notice from the standard output");
boost::program_options::variables_map vm;
- try{
+ try {
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, options), vm, true);
}
- catch(boost::program_options::error & e)
+ catch (boost::program_options::error & e)
{
std::cerr << e.what() << std::endl;
exit(-1);
}
- if (!vm.count("hide-copyright"))
+ if (!vm.count("hide-copyright")) // if the user doesn't hide the bloaty copyright text
{
printLicense();
}
- if (vm.count("help"))
+ if (vm.count("help")) // if the user only interested in the help, there is no need to check the variables
{
std::cout << options << std::endl;
exit(0);
}
- else
+ else // check the variables if they are set up properly
{
processInput(vm);
}
@@ -112,14 +111,14 @@ std::shared_ptr sdddstCore::ProjectParser::getSimula
return sD;
}
-void sdddstCore::ProjectParser::printLicense()
+void sdddstCore::ProjectParser::printLicense() // if used multiple times, should move outside this cpp
{
std::cout << "SDDDST - Simple Discrete Dislocation Dynamics Toolkit\n"
- "Copyright (C) 2015-2019 Gábor Péterffy \n"
- "This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; see the license for details\n";
+ "Copyright (C) 2015-2019 Gábor Péterffy \n"
+ "This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; see the license for details\n";
}
-void sdddstCore::ProjectParser::processInput(boost::program_options::variables_map &vm)
+void sdddstCore::ProjectParser::processInput(boost::program_options::variables_map & vm)
{
// Check for required options
if (0 == vm.count("dislocation-configuration"))
@@ -137,7 +136,7 @@ void sdddstCore::ProjectParser::processInput(boost::program_options::variables_m
if (vm.count("point-defect-configuration") == 1)
{
sD = std::shared_ptr(new SimulationData(vm["dislocation-configuration"].as(),
- vm["point-defect-configuration"].as()));
+ vm["point-defect-configuration"].as()));
}
else
{
@@ -180,7 +179,7 @@ void sdddstCore::ProjectParser::processInput(boost::program_options::variables_m
if (vm.count("point-defect-configuration"))
{
- sD->A *= 1./sqrt(sD->dc);
+ sD->A *= 1. / sqrt(sD->dc);
sD->KASQR *= double(sD->dc);
}
@@ -233,12 +232,12 @@ void sdddstCore::ProjectParser::processInput(boost::program_options::variables_m
tmp->loadStress(vm["periodic-stress-field-elte"].as(), "xy_diff_x", 1024);
sD->tau = std::move(tmp);
}
- /*
- "no-external-stress", "no external stress during the simulation (default)")
- ("fixed-rate-external-stress", boost::program_options::value(), "external stress is linear with time, rate should be specified as an arg")
- ("spring-constant"
+ /*
+ "no-external-stress", "no external stress during the simulation (default)")
+ ("fixed-rate-external-stress", boost::program_options::value(), "external stress is linear with time, rate should be specified as an arg")
+ ("spring-constant"
- ;*/
+ ;*/
if (vm.count("no-external-stress") && vm.count("fixed-rate-external-stress"))
{
std::cerr << "Only one stress protocol can be defined at the same time!\n";
diff --git a/src/sdddstCMakeConfig.h b/src/sdddstCMakeConfig.h
new file mode 100644
index 0000000..c4fa43d
--- /dev/null
+++ b/src/sdddstCMakeConfig.h
@@ -0,0 +1,14 @@
+/* Include the options set in CMakeLists.txt
+ * and other project related settings
+ */
+#define SDDDST_VERSION_MAJOR "@sdddst_VERSION_MAJOR@"
+#define SDDDST_VERSION_MINOR "@sdddst_VERSION_MINOR@"
+
+#define SDDDST_NAME "@PROJECT_NAME@"
+
+#define PYTHON_LIB_NAME @PYTHON_LIB_NAME@
+
+#if 1 == @sdddst_VERBOSE@
+ #define SDDDST_VERBOSE
+#endif
+
diff --git a/src/simulation.cpp b/src/simulation.cpp
index fe220fd..c0edf65 100644
--- a/src/simulation.cpp
+++ b/src/simulation.cpp
@@ -358,7 +358,7 @@ void Simulation::solveEQSys()
void Simulation::calculateXError()
{
- for (size_t i = 0; i < sD->dc; i++)
+ for (unsigned int i = 0; i < sD->dc; i++)
{
double tmp = fabs(sD->bigStep[i].x - sD->secondSmall[i].x);
pH->updateError(tmp, i);