Commit 77f9dc9a authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[example1] update README.md

parent 631aebd5
...@@ -7,7 +7,9 @@ Example 1 ...@@ -7,7 +7,9 @@ Example 1
========= =========
In this exemplary application, a network of quadrilateral fractures is generated In this exemplary application, a network of quadrilateral fractures is generated
within the unit cube (see image above). within the unit cube (see image above). The main file containing the source code
to this example is the file `example1.cc` which is located in this folder.
Two main orientations are considered for the quadrilaterals, for both of which Two main orientations are considered for the quadrilaterals, for both of which
a corresponding instance of the `QuadrilateralSampler` class is created. a corresponding instance of the `QuadrilateralSampler` class is created.
For example, we instantiate the sampler class for the second orientation with: For example, we instantiate the sampler class for the second orientation with:
...@@ -31,11 +33,20 @@ a mean value of 0° and a standard deviation of 5°. The fourth argument is the ...@@ -31,11 +33,20 @@ a mean value of 0° and a standard deviation of 5°. The fourth argument is the
distribution to be used for sampling the edge lengths, while the last argument distribution to be used for sampling the edge lengths, while the last argument
defines a minimum value below which the edge length must not fall. defines a minimum value below which the edge length must not fall.
The quadrilaterals are then sampled from the two samplers `quadSampler1` and `quadSampler2` The quadrilaterals are then sampled from the two samplers `quadSampler1` and
until the desired number of quadrilaterals has been created. However, we want to `quadSampler2`, using the `()` operator:
enforce certain constraints such as a minimum distance between entities. For this
we use instances of the `EntityNetworkConstraints` class and configure it as desired. ```cpp
For example, the constraints on entities of the same orientation are defined as follows: auto quad = sampleIntoSet1 ? quadSampler1() : quadSampler2();
```
In this example we use the boolean variable `sampleIntoSet1` to determine from
which sampler we should sample the next quadrilateral (more details follow below).
The variable `quad` holds a new candidate for an entity of the network, however,
However, we want to enforce certain constraints such as a minimum distance between
entities. For this we use instances of the `EntityNetworkConstraints` class and
configure it as desired. For example, the constraints on entities of the same
orientation are defined in this example as follows:
```cpp ```cpp
EntityNetworkConstraints constraintsOnSelf; EntityNetworkConstraints constraintsOnSelf;
...@@ -55,10 +66,11 @@ if (!constraintsOnSelf.evaluate(entitySet, quad)) ...@@ -55,10 +66,11 @@ if (!constraintsOnSelf.evaluate(entitySet, quad))
``` ```
where `entityset1` and `entitySet2` are of type `std::vector<Quadrilateral>` and where `entityset1` and `entitySet2` are of type `std::vector<Quadrilateral>` and
store all quadrilaterals that are accepted. The sampling of quadrilaterals of the store all quadrilaterals that are accepted. The function `evaluate` of the
two orientations happens subsequently, and the boolean variable `sampleIntoSet1` `EntityNetworkConstraints` class evaluates the constraints for `quad` against all
contains the information from which orientation it is currently sampled. After an entities contained in `entitySet` and returns `true` only if there no violation of
admissible quadrilateral has been generated, the line any of the defined constraints has been found. After an admissible quadrilateral
has been generated, the line
```cpp ```cpp
// sample into the other set the next time // sample into the other set the next time
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment