Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/geometrycentral/surface/exact_geodesics.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class GeodesicAlgorithmExact {
bool check_stop_conditions(unsigned& index) const;

void clear();
void clear_data();

list_pointer interval_list(Edge e) { return &m_edge_interval_lists[e]; };
const_list_pointer interval_list(Edge e) const { return &m_edge_interval_lists[e]; };
Expand Down
34 changes: 29 additions & 5 deletions src/surface/exact_geodesics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ GeodesicAlgorithmExact::GeodesicAlgorithmExact(SurfaceMesh& mesh_, IntrinsicGeom
: m_max_propagation_distance(1e100), mesh(mesh_), geom(geom_), m_memory_allocator(mesh_.nEdges(), mesh_.nEdges()) {

geom.requireEdgeLengths();
geom.requireCornerAngles();
geom.requireVertexGaussianCurvatures();

m_edge_interval_lists = EdgeData<IntervalList>(mesh);
for (Edge e : mesh.edges()) {
Expand Down Expand Up @@ -443,9 +445,19 @@ void GeodesicAlgorithmExact::propagate(const std::vector<SurfacePoint>& sources,
m_queue_max_size = 0;

IntervalWithStop candidates[2];
geom.requireCornerAngles();

int itr = 0;
auto _start = std::chrono::high_resolution_clock::now();
auto _before = _start;

while (!m_queue.empty()) {
itr++;

auto _now = std::chrono::high_resolution_clock::now();
// std::cout << " " << itr << ": " << std::chrono::duration_cast<std::chrono::microseconds>(_now - _before).count() << "us" << std::endl;

_before = _now;

m_queue_max_size = std::max(m_queue.size(), m_queue_max_size);

unsigned const check_period = 10;
Expand All @@ -469,9 +481,7 @@ void GeodesicAlgorithmExact::propagate(const std::vector<SurfacePoint>& sources,
bool const last_interval = min_interval->next() == nullptr;

auto saddleOrBoundary = [&](Vertex v) -> bool {
geom.requireVertexGaussianCurvatures();
bool saddle = geom.vertexGaussianCurvatures[v] < 0;
geom.unrequireVertexGaussianCurvatures();
return saddle || vertexIsBoundary[v];
};

Expand Down Expand Up @@ -606,8 +616,6 @@ void GeodesicAlgorithmExact::propagate(const std::vector<SurfacePoint>& sources,
clock_t stop = clock();
m_time_consumed = (static_cast<double>(stop) - static_cast<double>(start)) / CLOCKS_PER_SEC;

geom.unrequireCornerAngles();

/* for(unsigned i=0; i<m_edge_interval_lists.size(); ++i)
{
list_pointer list = &m_edge_interval_lists[i];
Expand Down Expand Up @@ -1380,5 +1388,21 @@ void GeodesicAlgorithmExact::clear() {
m_propagation_distance_stopped = GEODESIC_INF;
};

void GeodesicAlgorithmExact::clear_data() {
// reset data except:
// - m_max_propagation_distance
// - mesh
// - geom
// - m_memory_allocator
// - m_edge_interval_lists
// - vertexIsManifold
// - vertexIsBoundary
m_stop_vertices.clear();
m_time_consumed = 0.0;
m_propagation_distance_stopped = GEODESIC_INF;
m_queue.clear();
m_sources.clear();
}

} // namespace surface
} // namespace geometrycentral