Memory and speed optimization: only study meshes when needed
This commit is contained in:
parent
e51dbb994d
commit
7eff002e21
@ -29,8 +29,8 @@ use constant I_FACET_EDGE => 6;
|
||||
use constant FE_TOP => 0;
|
||||
use constant FE_BOTTOM => 1;
|
||||
|
||||
# always make sure BUILD is idempotent
|
||||
sub BUILD {
|
||||
# always make sure this method is idempotent
|
||||
sub analyze {
|
||||
my $self = shift;
|
||||
|
||||
@{$self->edges} = ();
|
||||
@ -145,6 +145,8 @@ sub clean {
|
||||
sub check_manifoldness {
|
||||
my $self = shift;
|
||||
|
||||
$self->analyze;
|
||||
|
||||
# look for any edges not connected to exactly two facets
|
||||
my ($first_bad_edge_id) =
|
||||
grep { @{ $self->edges_facets->[$_] } != 2 } 0..$#{$self->edges_facets};
|
||||
@ -154,6 +156,10 @@ sub check_manifoldness {
|
||||
map @{$self->vertices->[$_]}, @{$self->edges->[$first_bad_edge_id]};
|
||||
return 0;
|
||||
}
|
||||
|
||||
# empty the edges array as we don't really need it anymore
|
||||
@{$self->edges} = ();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user