Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tools
frackit
Commits
08f06386
Commit
08f06386
authored
Oct 27, 2020
by
Dennis Gläser
Browse files
[ex3] use new quad sampler
parent
d8abb6c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
appl/example3/README.md
View file @
08f06386
...
...
@@ -53,23 +53,27 @@ const auto domainBBox = OCCUtilities::getBoundingBox(networkDomain);
With this, we create a quadrilateral sampler in a similar way as in the previous examples
```
cpp
QuadrilateralSampler
<
3
>
quadSampler
(
makeUniformPointSampler
(
domainBBox
),
// sampler for quadrilateral center points
Distro
(
toRadians
(
45.0
),
toRadians
(
5.0
)),
// strike angle: mean value & standard deviation
Distro
(
toRadians
(
90.0
),
toRadians
(
5.0
)),
// dip angle: mean value & standard deviation
Distro
(
45.0
,
5.0
),
// edge length: mean value & standard deviation
5.0
);
// threshold for minimum edge length
// we use the default sampler types, thus, default distributions (see traits classes)
using
NormalDistro
=
std
::
normal_distribution
<
ctype
>
;
using
UniformDistro
=
std
::
uniform_real_distribution
<
ctype
>
;
QuadrilateralSampler
<
3
>
quadSampler
(
makeUniformPointSampler
(
domainBBox
),
// sampler for quadrilateral center points
NormalDistro
(
toRadians
(
45.0
),
toRadians
(
5.0
)),
// strike angle: mean value & standard deviation
NormalDistro
(
toRadians
(
90.0
),
toRadians
(
5.0
)),
// dip angle: mean value & standard deviation
UniformDistro
(
30.0
,
60.0
),
// strike length
UniformDistro
(
30.0
,
60.0
));
// dip length
```
For the entities of the other orientation, we want to use
`Disk`
objects in this case.
The instantiation of the corrensponding sampler class looks like this:
```
cpp
DiskSampler
diskSampler
(
makeUniformPointSampler
(
domainBBox
),
// sampler for disk center points
Distro
(
30.0
,
6.5
),
// major axis length: mean value & standard deviation
Distro
(
24.0
,
4.5
),
// minor axis length: mean value & standard deviation
Distro
(
toRadians
(
0.0
),
toRadians
(
7.5
)),
// rotation around x-axis: mean value & standard deviation
Distro
(
toRadians
(
0.0
),
toRadians
(
7.5
)),
// rotation around y-axis: mean value & standard deviation
Distro
(
toRadians
(
0.0
),
toRadians
(
7.5
)));
// rotation around z-axis: mean value & standard deviation
DiskSampler
diskSampler
(
makeUniformPointSampler
(
domainBBox
),
// sampler for disk center points
Normal
Distro
(
30.0
,
6.5
),
// major axis length: mean value & standard deviation
Normal
Distro
(
24.0
,
4.5
),
// minor axis length: mean value & standard deviation
Normal
Distro
(
toRadians
(
0.0
),
toRadians
(
7.5
)),
// rotation around x-axis: mean value & standard deviation
Normal
Distro
(
toRadians
(
0.0
),
toRadians
(
7.5
)),
// rotation around y-axis: mean value & standard deviation
Normal
Distro
(
toRadians
(
0.0
),
toRadians
(
7.5
)));
// rotation around z-axis: mean value & standard deviation
```
...
...
appl/example3/example3.cc
View file @
08f06386
...
...
@@ -71,26 +71,27 @@ int main(int argc, char** argv)
// and disk/quadrilaterals as entities (using the sampled center points) //
//////////////////////////////////////////////////////////////////////////////
// we use the default sampler types -> normal distributions for all parameters
using
Distro
=
std
::
normal_distribution
<
ctype
>
;
// we use the default sampler types, thus, default distributions (see traits classes)
using
NormalDistro
=
std
::
normal_distribution
<
ctype
>
;
using
UniformDistro
=
std
::
uniform_real_distribution
<
ctype
>
;
// Bounding box of the domain in which we want to place the entities
const
auto
domainBBox
=
OCCUtilities
::
getBoundingBox
(
networkDomain
);
// sampler for disks (orientation 1)
DiskSampler
diskSampler
(
makeUniformPointSampler
(
domainBBox
),
// sampler for disk center points
Distro
(
30.0
,
6.5
),
// major axis length: mean value & standard deviation
Distro
(
24.0
,
4.5
),
// minor axis length: mean value & standard deviation
Distro
(
toRadians
(
0.0
),
toRadians
(
7.5
)),
// rotation around x-axis: mean value & standard deviation
Distro
(
toRadians
(
0.0
),
toRadians
(
7.5
)),
// rotation around y-axis: mean value & standard deviation
Distro
(
toRadians
(
0.0
),
toRadians
(
7.5
)));
// rotation around z-axis: mean value & standard deviation
Normal
Distro
(
30.0
,
6.5
),
// major axis length: mean value & standard deviation
Normal
Distro
(
24.0
,
4.5
),
// minor axis length: mean value & standard deviation
Normal
Distro
(
toRadians
(
0.0
),
toRadians
(
7.5
)),
// rotation around x-axis: mean value & standard deviation
Normal
Distro
(
toRadians
(
0.0
),
toRadians
(
7.5
)),
// rotation around y-axis: mean value & standard deviation
Normal
Distro
(
toRadians
(
0.0
),
toRadians
(
7.5
)));
// rotation around z-axis: mean value & standard deviation
// sampler for quadrilaterals (orientation 2)
QuadrilateralSampler
<
3
>
quadSampler
(
makeUniformPointSampler
(
domainBBox
),
// sampler for quadrilateral center points
Distro
(
toRadians
(
45.0
),
toRadians
(
5.0
)),
// strike angle: mean value & standard deviation
Distro
(
toRadians
(
90.0
),
toRadians
(
5.0
)),
// dip angle: mean value & standard deviation
Distro
(
45
.0
,
5
.0
),
//
edg
e length
: mean value & standard deviation
5
.0
);
// threshold for minimum edge
length
Normal
Distro
(
toRadians
(
45.0
),
toRadians
(
5.0
)),
// strike angle: mean value & standard deviation
Normal
Distro
(
toRadians
(
90.0
),
toRadians
(
5.0
)),
// dip angle: mean value & standard deviation
Uniform
Distro
(
30
.0
,
60
.0
),
//
strik
e length
UniformDistro
(
30.0
,
60
.0
)
)
;
// dip
length
// Define ids for the two entity sets
const
Id
diskSetId
(
1
);
// we give the set of orientation one, consisting of disks, the id 1
...
...
appl/example3/example3.py
View file @
08f06386
...
...
@@ -64,8 +64,8 @@ diskSampler = DiskSampler(makeUniformPointSampler(domainBBox), # sampl
quadSampler
=
QuadrilateralSampler
(
makeUniformPointSampler
(
domainBBox
),
# sampler for quadrilateral center points
normalSampler
(
toRadians
(
45.0
),
toRadians
(
5.0
)),
# strike angle: mean value & standard deviation
normalSampler
(
toRadians
(
90.0
),
toRadians
(
5.0
)),
# dip angle: mean value & standard deviation
n
orm
al
Sampler
(
45
.0
,
5
.0
),
#
edg
e length
: mean value & standard deviation
5.0
)
# threshold for minimum edge
length
unif
ormSampler
(
30
.0
,
60
.0
),
#
strik
e length
uniformSampler
(
30.0
,
60.0
))
# dip
length
# Define ids for the two entity sets
diskSetId
=
Id
(
1
)
# we give the set of orientation one, consisting of disks, the id 1
...
...
@@ -103,15 +103,15 @@ constraintsOnOther.setMinIntersectingAngle(toRadians(40.0))
# We can use the constraints matrix to facilitate constraint evaluation
constraintsMatrix
=
EntityNetworkConstraintsMatrix
()
constraintsMatrix
.
addConstraints
(
constraints1
,
# constraint instance
[
diskSetId
.
get
()
,
diskSetId
.
get
()
])
# sets between which to use these constraints
constraintsMatrix
.
addConstraints
(
constraints1
,
# constraint instance
[
diskSetId
,
diskSetId
])
# sets between which to use these constraints
constraintsMatrix
.
addConstraints
(
constraints2
,
# constraint instance
[
quadSetId
.
get
()
,
quadSetId
.
get
()
])
# sets between which to use these constraints
constraintsMatrix
.
addConstraints
(
constraints2
,
# constraint instance
[
quadSetId
,
quadSetId
])
# sets between which to use these constraints
constraintsMatrix
.
addConstraints
(
constraintsOnOther
,
# constraint instance
[[
diskSetId
.
get
()
,
quadSetId
.
get
()
],
# sets between which to use these constraints
[
quadSetId
.
get
()
,
diskSetId
.
get
()
]])
# sets between which to use these constraints
constraintsMatrix
.
addConstraints
(
constraintsOnOther
,
# constraint instance
[[
diskSetId
,
quadSetId
],
# sets between which to use these constraints
[
quadSetId
,
diskSetId
]])
# sets between which to use these constraints
# Moreover, we define constraints w.r.t. the domain boundary
constraintsOnDomain
=
makeDefaultConstraints
()
...
...
@@ -130,7 +130,7 @@ status.setTargetCount(diskSetId, 12) # we want 11 entities of orientation 1
status
.
setTargetCount
(
quadSetId
,
16
)
# we want 13 entities of orientation 2
# store all entity sets in a dictionary
entitySets
=
{
diskSetId
.
get
()
:
[],
quadSetId
.
get
()
:
[]}
entitySets
=
{
diskSetId
:
[],
quadSetId
:
[]}
# Alternate between set 1 & set 2 during sampling phase
sampleIntoSet1
=
True
...
...
@@ -163,7 +163,7 @@ while not status.finished():
continue
# the geometry is admissible
entitySets
[
id
.
get
()
].
append
(
geom
)
entitySets
[
id
].
append
(
geom
)
status
.
increaseCounter
(
id
)
status
.
print
()
...
...
@@ -184,7 +184,7 @@ print("\nEntity density of the contained network: {:f} m²/m³\n".format(density
##########################################################################
# construct and write a contained network, i.e. write out both network and domain.
print
(
"Building and writing contained, confined network
\n
"
)
print
(
"Building and writing contained, confined network"
)
from
frackit.entitynetwork
import
EntityNetworkBuilder
,
ContainedEntityNetworkBuilder
builder
=
ContainedEntityNetworkBuilder
();
...
...
@@ -205,7 +205,7 @@ gmshWriter.write("contained_confined", # body of the filename to be used (will a
# we can also not confine the network to its sub-domain,
# simply by adding the sub-domains as non-confining
print
(
"Building and writing contained, unconfined network
\n
"
)
print
(
"Building and writing contained, unconfined network"
)
builder
.
clear
();
builder
.
addSubDomain
(
solids
[
0
],
Id
(
1
));
builder
.
addSubDomain
(
networkDomain
,
Id
(
2
));
...
...
@@ -226,7 +226,7 @@ gmshWriter = GmshWriter(uncontainedBuilder.build());
gmshWriter
.
write
(
"uncontained_confined"
,
2.5
);
# ... or not confining it
print
(
"Building and writing uncontained, unconfined network
\n
"
)
print
(
"Building and writing uncontained, unconfined network"
)
uncontainedBuilder
.
clear
();
for
setId
in
entitySets
:
uncontainedBuilder
.
addSubDomainEntities
(
entitySets
[
setId
],
Id
(
2
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment