Skip to content

Commit

Permalink
[Amibe] The RemeshSkeleton tolerance now depends on the metric
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromerobert committed Aug 26, 2019
1 parent 2f39a13 commit f804082
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion amibe/python/remesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def __remesh(options):
if options.forced_bounds:
BeamInsertion(liaison.mesh, point_metric).insert(
options.forced_bounds[0], options.forced_bounds[1])
RemeshSkeleton(liaison, options.boundary_angle, options.size / 100.0, point_metric).compute()
RemeshSkeleton(liaison, options.boundary_angle, point_metric, 0.01).compute()
else:
RemeshSkeleton(liaison, options.boundary_angle, options.size / 100.0, options.size).compute()
if options.forced_bounds:
Expand Down
2 changes: 1 addition & 1 deletion amibe/python/remeshSingularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def remesh(**kwargs):

# Remesh Skeleton
if kwargs['skeleton']:
RemeshSkeleton(liaison, 1.66, kwargs['sizeinf']/100.0, metric).compute()
RemeshSkeleton(liaison, 1.66, metric, 0.01).compute()

# Remesh
refineOptions = HashMap()
Expand Down
20 changes: 12 additions & 8 deletions amibe/src/org/jcae/mesh/amibe/algos3d/RemeshSkeleton.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@
public class RemeshSkeleton {
private final Mesh mesh;
private final double angle;
/** tolerance for point insertion */
private final double tolerance;
/**
* Factor to apply to the square of distance metric to get the square of the
* distance tolerance for point insertion
*/
private final double toleranceFactor;
private final AnalyticMetricInterface metric;
private final MeshLiaison liaison;
private final VertexSwapper vertexSwapper;
private double swapVolume;

public RemeshSkeleton(MeshLiaison liaison, double angle, double tolerance,
final double size) {
this(liaison, angle, tolerance, new AnalyticMetricInterface() {
this(liaison, angle, new AnalyticMetricInterface() {

public double getTargetSize(double x, double y, double z, int groupId) {
return size;
Expand All @@ -59,15 +62,15 @@ public double getTargetSize(double x, double y, double z, int groupId) {
public double getTargetSizeTopo(Mesh mesh, Vertex v) {
return size;
}
});
}, tolerance / size);
}

public RemeshSkeleton(MeshLiaison liaison, double angle, double tolerance,
AnalyticMetricInterface metric) {
public RemeshSkeleton(MeshLiaison liaison, double angle,
AnalyticMetricInterface metric, double toleranceFactor) {
this.liaison = liaison;
this.mesh = liaison.getMesh();
this.angle = angle;
this.tolerance = tolerance * tolerance;
this.toleranceFactor = toleranceFactor * toleranceFactor;
this.metric = metric;
vertexSwapper = new VertexSwapper(liaison)
{
Expand Down Expand Up @@ -138,6 +141,8 @@ public void compute()
for(int k = 0; k < toInsert.size(); k++)
{
Vertex v = toInsert.get(k);
double m2 = metric.getTargetSize(v.getX(), v.getY(), v.getZ(), -1);
double tolerance = m2 * m2 * toleranceFactor;
int segId = bgLink.get(k);
AbstractHalfEdge toSplit = edgeIndex.get(segId);
double od = v.sqrDistance3D(toSplit.origin());
Expand All @@ -160,7 +165,6 @@ else if(dd <= tolerance)
liaison.move(v, v, true);
AbstractHalfEdge e = getEdge(v, oldDestination);
edgeIndex.set(segId, e);
double m2 = metric.getTargetSizeTopo(mesh, v);
swapVolume = m2 * m2 * m2 / 64;
vertexSwapper.swap(v);
}
Expand Down

0 comments on commit f804082

Please sign in to comment.