Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expensive gmi_is_point_in_region called during ma::adapt #444

Closed
bobpaw opened this issue Aug 9, 2024 · 6 comments
Closed

Expensive gmi_is_point_in_region called during ma::adapt #444

bobpaw opened this issue Aug 9, 2024 · 6 comments

Comments

@bobpaw
Copy link
Collaborator

bobpaw commented Aug 9, 2024

I'm reporting an issue in ma::adapt where an unnecessarily expensive call (depending on geometric complexity) is made to gmi_is_point_in_region.

Call stack (from gdb):

#0  gmi_is_point_in_region (m=0x8df910, e=0xb, point=0x7ffffffed030)
    at gmi/gmi.c:143
#1  0x00007ffff7cc366d in apf::Mesh::isParamPointInsideModel (this=this@entry=0x7f9d80,
    g=g@entry=0x2a, param=..., x=...)
    at apf/apfMesh.cc:271
#2  0x00007ffff7e77589 in ma::interpolateParametricCoordinatesOnRegularFace (p=..., b=...,
    a=..., t=0.5, g=0x2a, m=0x7f9d80)
    at ma/maSnap.cc:500
#3  ma::interpolateParametricCoordinatesOnFace (p=..., b=..., a=..., t=0.5, g=0x2a,
    m=0x7f9d80) at ma/maSnap.cc:570
#4  ma::interpolateParametricCoordinates (m=0x7f9d80, g=0x2a, t=0.5, a=..., b=..., p=...)
    at ma/maSnap.cc:586
#5  0x00007ffff7e7781b in ma::transferParametricBetween (p=..., t=0.5, v=0x7ffffffed0c0,
    g=0x2a, m=0x7f9d80) at ma/maSnap.cc:601
#6  ma::transferParametricOnEdgeSplit (m=m@entry=0x7f9d80, e=e@entry=0xc9ea2, t=t@entry=0.5,
    p=...) at ma/maSnap.cc:615
#7  0x00007ffff7e5fecb in ma::makeSplitVert (r=r@entry=0x6f6d550, edge=edge@entry=0xc9ea2)
    at ma/maRefine.cc:144
#8  0x00007ffff7e62d8a in ma::splitEdge (r=0x6f6d550, edge=0xc9ea2, v=0x7ffffffed240)
    at ma/maTemplates.cc:81
#9  0x00007ffff7e601af in ma::splitElement (r=r@entry=0x6f6d550, e=e@entry=0xc9ea2)
    at ma/maRefine.cc:244
#10 0x00007ffff7e60643 in ma::splitElements (r=r@entry=0x6f6d550)
    at ma/maRefine.cc:334
#11 0x00007ffff7e60dbd in ma::refine (a=a@entry=0x816270)
    at ma/maRefine.cc:437
#12 0x00007ffff7e5bf77 in ma::adaptVerbose (in=in@entry=0x8e0220, verbose=verbose@entry=false)
    at ma/ma.cc:79
#13 0x000000000040450e in main (argc=<optimized out>, argv=<optimized out>)
    at capstone_clis/capAdapt.cc:972

I'm not particularly well-versed in the adapt code, but this should be avoidable during adaptation.

@cwsmith
Copy link
Contributor

cwsmith commented Aug 9, 2024

I think there are scenarios where it makes sense to run the check. For example, if an mesh edge classified on the model boundary is being split then the point where it is split could be outside the domain of the geometric model. A crude drawing is attached.
splitEdge

@joshia5
Copy link
Contributor

joshia5 commented Aug 9, 2024

for reference, can you add details on the adaptation inputs you're using? or a the link to the main function if available

@bobpaw
Copy link
Collaborator Author

bobpaw commented Aug 9, 2024

for reference, can you add details on the adaptation inputs you're using? or a the link to the main function if available

This are the inputs we're using.

ma::Input* in;
in = ma::makeAdvanced(ma::configure(apfMesh, mdsScaleField, mdsFrameField));
in->shouldSnap = true;
in->shouldTransferParametric = true;
in->shouldFixShape = true;
in->shouldForceAdaptation = true;
if (apfMesh->getDimension() == 2)
  in->goodQuality = 0.04; // this is mean-ratio squared
 else // 3D meshes
   in->goodQuality = 0.027; // this is the mean-ratio cubed
in->maximumIterations = 10;

We are calling it from a file similar to capstone_clis/capStoneAnisoAdapt.cc

@cwsmith
Copy link
Contributor

cwsmith commented Aug 12, 2024

For reference, this commit 4b51494 added the check.

@bobpaw
Copy link
Collaborator Author

bobpaw commented Sep 13, 2024

I believe this is closed by #446?

@cwsmith
Copy link
Contributor

cwsmith commented Sep 13, 2024

Yeah. It should be all set.

@cwsmith cwsmith closed this as completed Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants