Merge branch 'cake_identification' into 'master'

fix cake identification, allow until revolve axis

See merge request ngsolve/netgen!621
This commit is contained in:
Hochsteger, Matthias 2023-12-28 11:42:33 +01:00
commit ec0f848030

View File

@ -256,7 +256,7 @@ namespace netgen
auto &s = shapes[i]; auto &s = shapes[i];
s->nr = i; s->nr = i;
for(auto & ident : s->identifications) for(auto & ident : s->identifications)
if(s.get() == ident.from) if(s.get() == ident.from && s.get() != ident.to)
ident.to->identifications.Append(ident); ident.to->identifications.Append(ident);
} }
}; };
@ -313,23 +313,23 @@ namespace netgen
{ {
bool need_inverse = ident.from == s.get(); bool need_inverse = ident.from == s.get();
auto other = need_inverse ? ident.to : ident.from; auto other = need_inverse ? ident.to : ident.from;
if(other->nr < s->primary->nr) if(other->nr <= s->primary->nr)
{ {
auto trafo = ident.trafo; auto trafo = ident.trafo;
if(need_inverse) if(need_inverse)
trafo = trafo.CalcInverse(); trafo = trafo.CalcInverse();
s->primary = other; s->primary = other;
s->primary_to_me.Combine(trafo, s->primary_to_me); s->primary_to_me.Combine(trafo, s->primary_to_me);
changed = true; changed = other->nr != s->primary->nr;
} }
if(other->primary->nr < s->primary->nr) if(other->primary->nr <= s->primary->nr)
{ {
auto trafo = ident.trafo; auto trafo = ident.trafo;
if(need_inverse) if(need_inverse)
trafo = trafo.CalcInverse(); trafo = trafo.CalcInverse();
s->primary = other->primary; s->primary = other->primary;
s->primary_to_me.Combine(trafo, other->primary_to_me); s->primary_to_me.Combine(trafo, other->primary_to_me);
changed = true; changed = other->primary->nr != s->primary->nr;
} }
} }
} }
@ -1071,7 +1071,7 @@ namespace netgen
auto n_dist = dst.GetNormal(trafo(mesh[sel[0]])); auto n_dist = dst.GetNormal(trafo(mesh[sel[0]]));
Mat<3> normal_matrix; Mat<3> normal_matrix;
CalcInverse(Trans(trafo.GetMatrix()), normal_matrix); CalcInverse(Trans(trafo.GetMatrix()), normal_matrix);
do_invert = n_src * (normal_matrix * n_dist) < 0.0; do_invert = (normal_matrix * n_src) * n_dist < 0.0;
} }
auto sel_new = sel; auto sel_new = sel;
sel_new.SetIndex(dst.nr+1); sel_new.SetIndex(dst.nr+1);