Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
V
vadere
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
110
Issues
110
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
3
Merge Requests
3
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vadere
vadere
Commits
9c467b36
Commit
9c467b36
authored
Jun 15, 2020
by
Benedikt Zoennchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix an incorrect endless recursion call.
parent
d2188ac0
Pipeline
#272516
passed with stages
in 131 minutes and 31 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
86 additions
and
9 deletions
+86
-9
VadereMeshing/src/org/vadere/meshing/examples/MeshQuantityPrinting.java
...src/org/vadere/meshing/examples/MeshQuantityPrinting.java
+2
-2
VadereMeshing/src/org/vadere/meshing/mesh/inter/IPolyConnectivity.java
.../src/org/vadere/meshing/mesh/inter/IPolyConnectivity.java
+1
-1
VadereMeshing/src/org/vadere/meshing/mesh/inter/ITriConnectivity.java
...g/src/org/vadere/meshing/mesh/inter/ITriConnectivity.java
+2
-1
VadereMeshing/src/org/vadere/meshing/mesh/triangulation/improver/distmesh/Parameters.java
...hing/mesh/triangulation/improver/distmesh/Parameters.java
+2
-2
VadereMeshing/src/org/vadere/meshing/mesh/triangulation/improver/eikmesh/gen/GenEikMesh.java
...g/mesh/triangulation/improver/eikmesh/gen/GenEikMesh.java
+6
-1
VadereMeshing/src/org/vadere/meshing/utils/MeshConstructor.java
...Meshing/src/org/vadere/meshing/utils/MeshConstructor.java
+73
-2
No files found.
VadereMeshing/src/org/vadere/meshing/examples/MeshQuantityPrinting.java
View file @
9c467b36
...
...
@@ -192,7 +192,7 @@ public class MeshQuantityPrinting {
bufferedWriterQualities2
.
write
(
"iteration quality\n"
);
BufferedWriter
bufferedWriterAngles
=
IOUtils
.
getWriter
(
"angles_eik.csv"
,
dir
);
bufferedWriterAngles
.
write
(
"iteration angle
3D
\n"
);
bufferedWriterAngles
.
write
(
"iteration angle\n"
);
int
init
=
1
;
while
(!
meshImprover
.
isInitialized
())
{
...
...
@@ -255,7 +255,7 @@ public class MeshQuantityPrinting {
bufferedWriterQualities2
.
write
(
"iteration quality\n"
);
BufferedWriter
bufferedWriterAngles
=
IOUtils
.
getWriter
(
"angles_dist.csv"
,
dir
);
bufferedWriterAngles
.
write
(
"iteration angle
3D
\n"
);
bufferedWriterAngles
.
write
(
"iteration angle\n"
);
int
iteration
=
1
;
while
(
iteration
<
maxIteration
+
1
)
{
...
...
VadereMeshing/src/org/vadere/meshing/mesh/inter/IPolyConnectivity.java
View file @
9c467b36
...
...
@@ -1390,7 +1390,7 @@ public interface IPolyConnectivity<V extends IVertex, E extends IHalfEdge, F ext
}
default
void
removeFaceAtBoundary
(
@NotNull
final
F
face
,
@NotNull
final
F
boundary
,
final
boolean
deleteIsolatedVertices
)
{
removeFaceAtBoundary
(
face
,
boundary
,
deleteIsolatedVertices
);
removeFaceAtBoundary
(
face
,
boundary
,
deleteIsolatedVertices
,
true
);
}
/**
...
...
VadereMeshing/src/org/vadere/meshing/mesh/inter/ITriConnectivity.java
View file @
9c467b36
...
...
@@ -2734,7 +2734,8 @@ public interface ITriConnectivity<V extends IVertex, E extends IHalfEdge, F exte
* this might happen if the line intersects a point, in this case both neighbouring edges are feasible
*/
if
(
inEdge
==
null
)
{
inEdge
=
getMesh
().
streamEdges
(
startFace
).
filter
(
e
->
isLeftOf
(
p
.
getX
(),
p
.
getY
(),
e
)).
findAny
().
get
();
Optional
<
E
>
optEdge
=
getMesh
().
streamEdges
(
startFace
).
filter
(
e
->
isLeftOf
(
p
.
getX
(),
p
.
getY
(),
e
)).
findAny
();
inEdge
=
optEdge
.
get
();
}
}
...
...
VadereMeshing/src/org/vadere/meshing/mesh/triangulation/improver/distmesh/Parameters.java
View file @
9c467b36
...
...
@@ -17,7 +17,7 @@ public class Parameters {
public
final
static
boolean
uniform
=
false
;
public
final
static
String
method
=
"Distmesh"
;
// "Distmesh" or "Density"
public
final
static
double
qualityMeasurement
=
0.95
;
public
final
static
double
qualityConvergence
=
0.0
1
;
public
final
static
double
qualityConvergence
=
0.0
;
public
final
static
double
MINIMUM
=
0.25
;
public
final
static
double
DENSITYWEIGHT
=
2
;
public
final
static
int
NPOINTS
=
100000
;
...
...
@@ -26,5 +26,5 @@ public class Parameters {
public
final
static
int
SEGMENTDIVISION
=
0
;
//TODO increase this
public
final
static
int
MAX_NUMBER_OF_STEPS
=
200
;
public
final
static
int
HIGHEST_LEGAL_TEST
=
10
;
public
final
static
int
HIGHEST_LEGAL_TEST
=
Integer
.
MAX_VALUE
;
}
VadereMeshing/src/org/vadere/meshing/mesh/triangulation/improver/eikmesh/gen/GenEikMesh.java
View file @
9c467b36
...
...
@@ -651,6 +651,9 @@ public class GenEikMesh<V extends IVertex, E extends IHalfEdge, F extends IFace>
// TODO: Get rid of VPoint
VPoint
p1p2
=
p1
.
subtract
(
p2
);
double
len
=
p1p2
.
distanceToOrigin
();
if
(
len
<=
GeometryUtils
.
DOUBLE_EPS
)
{
return
new
VPoint
(
0
,
0
);
}
double
desiredLen
=
0.9
*
Math
.
sqrt
(
3
)
*
getDesiredEdgeLength
(
p1
,
p2
);
double
ratio
=
len
/
desiredLen
;
double
absForce
=
f
.
apply
(
ratio
);
...
...
@@ -1379,9 +1382,11 @@ public class GenEikMesh<V extends IVertex, E extends IHalfEdge, F extends IFace>
IPoint
velocity
=
getForce
(
vertex
);
double
factor
=
1.0
;
IPoint
movement
=
velocity
.
scalarMultiply
(
delta
*
factor
);
while
(!
move
(
vertex
,
vertex
.
getX
()
+
movement
.
getX
(),
vertex
.
getY
()
+
movement
.
getY
()))
{
int
count
=
0
;
while
(!
move
(
vertex
,
vertex
.
getX
()
+
movement
.
getX
(),
vertex
.
getY
()
+
movement
.
getY
())
&&
count
<
10
)
{
factor
/=
2.0
;
movement
=
velocity
.
scalarMultiply
(
delta
*
factor
);
count
++;
}
}
...
...
VadereMeshing/src/org/vadere/meshing/utils/MeshConstructor.java
View file @
9c467b36
...
...
@@ -16,13 +16,19 @@ import org.vadere.meshing.mesh.triangulation.IEdgeLengthFunction;
import
org.vadere.meshing.mesh.triangulation.improver.eikmesh.impl.PEikMesh
;
import
org.vadere.meshing.mesh.triangulation.triangulator.impl.PRuppertsTriangulator
;
import
org.vadere.meshing.utils.color.Colors
;
import
org.vadere.meshing.utils.io.IOUtils
;
import
org.vadere.meshing.utils.io.tex.TexGraphGenerator
;
import
org.vadere.util.geometry.GeometryUtils
;
import
org.vadere.util.geometry.shapes.VPoint
;
import
org.vadere.util.geometry.shapes.VPolygon
;
import
org.vadere.util.geometry.shapes.VRectangle
;
import
org.vadere.util.logging.Logger
;
import
org.vadere.util.math.IDistanceFunction
;
import
java.awt.*
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Collection
;
import
java.util.function.Function
;
import
java.util.function.Predicate
;
...
...
@@ -30,7 +36,6 @@ import java.util.function.Predicate;
public
class
MeshConstructor
{
private
static
Logger
logger
=
Logger
.
getLogger
(
MeshConstructor
.
class
);
public
IMesh
<
PVertex
,
PHalfEdge
,
PFace
>
pslgToCoarsePMesh
(
@NotNull
final
PSLG
pslg
,
final
boolean
viszalize
)
{
VRectangle
bound
=
GeometryUtils
.
boundRelativeSquared
(
pslg
.
getSegmentBound
().
getPoints
(),
0.3
);
PSLG
boundedPSLG
=
pslg
.
conclose
(
bound
);
...
...
@@ -67,10 +72,14 @@ public class MeshConstructor {
logger
.
info
(
"construct distance function"
);
IDistanceFunction
distanceFunctionApproximation
=
new
DistanceFunctionApproxBF
(
pslg
,
distanceFunction
,
()
->
new
PMesh
());
IEdgeLengthFunction
edgeLengthFunction
=
p
->
hmin
+
smoothness
*
Math
.
abs
((
(
DistanceFunctionApproxBF
)
distanceFunctionApproximation
).
apply
(
p
));
IEdgeLengthFunction
edgeLengthFunction
=
p
->
hmin
+
smoothness
*
Math
.
abs
((
distanceFunctionApproximation
).
apply
(
p
));
EdgeLengthFunctionApprox
edgeLengthFunctionApprox
=
new
EdgeLengthFunctionApprox
(
pslg
,
edgeLengthFunction
,
p
->
hmax
);
edgeLengthFunctionApprox
.
smooth
(
smoothness
);
logger
.
info
(
"construct element size function"
);
//((DistanceFunctionApproxBF) distanceFunctionApproximation).printPython();
//edgeLengthFunctionApprox.printPython();
//edgeLengthFunctionApprox.printPython();
...
...
@@ -105,9 +114,41 @@ public class MeshConstructor {
while
(!
meshImprover
.
isFinished
())
{
synchronized
(
meshImprover
.
getMesh
())
{
meshImprover
.
improve
();
logger
.
info
(
"quality = "
+
meshImprover
.
getQuality
());
}
meshPanel
.
repaint
();
}
logger
.
info
(
"generation completed."
);
/*BufferedWriter meshWriter = null;
try {
File dir = new File("/Users/bzoennchen/Development/workspaces/hmRepo/PersZoennchen/PhD/trash/generated/eikmesh/");
BufferedWriter bufferedWriterQualities1 = IOUtils.getWriter("qualities1_eik.csv", dir);
bufferedWriterQualities1.write("iteration quality\n");
BufferedWriter bufferedWriterQualities2 = IOUtils.getWriter("qualities2_eik.csv", dir);
bufferedWriterQualities2.write("iteration quality\n");
BufferedWriter bufferedWriterAngles = IOUtils.getWriter("angles_eik.csv", dir);
bufferedWriterAngles.write("iteration angle\n");
bufferedWriterQualities1.write(printQualities(200, meshImprover.getMesh(), f -> meshImprover.getTriangulation().faceToQuality(f)));
bufferedWriterQualities1.close();
bufferedWriterQualities2.write(printQualities(200, meshImprover.getMesh(), f -> meshImprover.getTriangulation().faceToLongestEdgeQuality(f)));
bufferedWriterQualities2.close();
bufferedWriterAngles.write(printAngles(200, meshImprover.getMesh()));
bufferedWriterAngles.close();
meshWriter = IOUtils.getWriter("kaiserslautern_mittel.tex", dir);
meshWriter.write(TexGraphGenerator.toTikz(meshImprover.getMesh(), f -> Colors.YELLOW, e -> Color.BLACK, vertexColorFunction, 1.0f, true));
meshWriter.close();
} catch (IOException e) {
e.printStackTrace();
}*/
}
else
{
meshImprover
.
generate
();
}
...
...
@@ -167,4 +208,34 @@ public class MeshConstructor {
return
meshImprover
.
getMesh
();
}
// delete this code
private
static
String
printAngles
(
int
iteration
,
IMesh
<
PVertex
,
PHalfEdge
,
PFace
>
mesh
){
StringBuilder
builder
=
new
StringBuilder
();
for
(
PFace
face
:
mesh
.
getFaces
())
{
for
(
PHalfEdge
edge
:
mesh
.
getEdges
(
face
))
{
VPoint
p1
=
mesh
.
toPoint
(
edge
);
VPoint
p2
=
mesh
.
toPoint
(
mesh
.
getNext
(
edge
));
VPoint
p3
=
mesh
.
toPoint
(
mesh
.
getPrev
(
edge
));
builder
.
append
(
iteration
);
builder
.
append
(
" "
);
builder
.
append
(
GeometryUtils
.
angle
(
p1
,
p2
,
p3
));
builder
.
append
(
"\n"
);
}
}
return
builder
.
toString
();
}
private
static
String
printQualities
(
int
iteration
,
IMesh
<
PVertex
,
PHalfEdge
,
PFace
>
mesh
,
Function
<
PFace
,
Double
>
rho
){
StringBuilder
builder
=
new
StringBuilder
();
for
(
PFace
face
:
mesh
.
getFaces
())
{
double
quality
=
rho
.
apply
(
face
);
builder
.
append
(
iteration
);
builder
.
append
(
" "
);
builder
.
append
(
quality
);
builder
.
append
(
"\n"
);
}
return
builder
.
toString
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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