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

Surface fitting updates #4116

Closed
wants to merge 23 commits into from
Closed

Surface fitting updates #4116

wants to merge 23 commits into from

Conversation

kmittal2
Copy link
Member

@kmittal2 kmittal2 commented Feb 7, 2024

Misc updates related to surface fitting capability.

PR Author Editor Reviewers Assignment Approval Merge
#4116 @kmittal2 @tzanio @vladotomov + @tzanio 2/13/24 ⌛due 2/27/24 ⌛due 3/5/24
PR Checklist
  • Code builds.
  • Code passes make style.
  • Update CHANGELOG:
    • Is this a new feature users need to be aware of? New or updated example or miniapp?
    • Does it make sense to create a new section in the CHANGELOG to group with other related features?
  • Update INSTALL:
    • Had a new optional library been added? If so, what range of versions of this library are required? (Make sure the external library is compatible with our BSD license, e.g. it is not licensed under GPL!)
    • Have the version ranges for any required or optional libraries changed?
    • Does make or cmake have a new target?
    • Did the requirements or the installation process change? (rare)
  • Update continuous integration server configurations if necessary (e.g. with new version requirements for each of MFEM's dependencies)
    • .github
    • .appveyor.yml
  • Update .gitignore:
    • Check if make distclean; git status shows any files that were generated from the source by the project (not an IDE) but we don't want to track in the repository.
    • Add new patterns (just for the new files above) and re-run the above test.
  • New examples:
    • All sample runs at the top of the example source file work.
    • Update examples/makefile:
      • Add the example code to the appropriate SEQ_EXAMPLES and PAR_EXAMPLES variables.
      • Add any files generated by it to the clean target.
      • Add the example binary and any files generated by it to the top-level .gitignore file.
    • Update examples/CMakeLists.txt:
      • Add the example code to the ALL_EXE_SRCS variable.
      • Make sure THIS_TEST_OPTIONS is set correctly for the new example.
    • List the new example in doc/CodeDocumentation.dox.
    • If new examples directory (e.g.examples/pumi), list it in doc/CodeDocumentation.conf.in
    • Companion pull request for documentation in mfem/web repo:
      • Update or add example-specific documentation, see e.g. the src/examples.md.
      • Add the description, labels and screenshots in src/examples.md and src/img.
      • In examples.md, list the example under the appropriate categories, add new categories if necessary.
      • Add a short description of the example in the "Extensive Examples" section of features.md.
  • New miniapps:
    • All sample runs at the top of the miniapp source file work.
    • Update top-level makefile and makefile in corresponding miniapp directory.
    • Add the miniapp binary and any files generated by it to the top-level .gitignore file.
    • Update CMake build system:
      • Update the CMakeLists.txt file in the miniapps directory, if the new miniapp is in a new directory.
      • Add/update the CMakeLists.txt file in the new miniapp directory.
      • Consider adding a new test for the new miniapp.
    • List the new miniapp in doc/CodeDocumentation.dox
    • If new miniapps directory (e.g.miniapps/nurbs), add it to MINIAPP_SUBDIRS in the makefile.
    • If new miniapps directory (e.g.miniapps/nurbs), list it in doc/CodeDocumentation.conf.in
    • Companion pull request for documentation in mfem/web repo:
      • Update or add miniapp-specific documentation, see e.g. the src/meshing.md and src/electromagnetics.md files.
      • Add the description, labels and screenshots in src/examples.md and src/img.
      • The miniapps go at the end of the page, and are usually listed only under a specific "Application (PDE)" category.
      • Add a short description of the miniapp in the "Extensive Examples" section of features.md.
  • New capability:
    • All new public, protected, and private classes, methods, data members, and functions have full Doxygen-style documentation in source comments. Documentation should include descriptions of member data, function arguments and return values, template parameters, and prerequisites for calling new functions.
    • Pointer arguments and return values must specify whether ownership is being transferred or lent with the call.
    • Any new functions should include descriptions of their intended use e.g. for internal use only, user-facing, etc., along with references to example code whenever possible/appropriate.
    • Consider adding new sample runs in existing examples to highlight the new capability.
    • Consider saving cool simulation pictures with the new capability in the Confluence gallery (LLNL only) or submitting them, via pull request, to the gallery section of the mfem/web repo.
    • If this is a major new feature, consider mentioning it in the short summary inside README (rare).
    • List major new classes in doc/CodeDocumentation.dox (rare).
  • Update this checklist, if the new pull request affects it.
  • Run make unittest to make sure all unit tests pass.
  • Run the tests in tests/scripts.
  • (LLNL only) After merging:
    • Update internal tests to include the new features.

@kmittal2 kmittal2 added mesh WIP Work in Progress labels Feb 7, 2024
@kmittal2 kmittal2 added ready-for-review and removed WIP Work in Progress labels Feb 12, 2024
@kmittal2 kmittal2 changed the title [WIP] Surface fitting updates Surface fitting updates Feb 12, 2024
@tzanio
Copy link
Member

tzanio commented Feb 13, 2024

This PR is now under review (see the table in the PR description). To help with the review process, please do not force push to the branch.

fem/gslib.hpp Outdated
@@ -290,6 +291,56 @@ class OversetFindPointsGSLIB : public FindPointsGSLIB
using FindPointsGSLIB::Interpolate;
};

/// Class for gather-scatter (gs) operations on Vectors based on corresponding
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have the same doxygen style as in the rest of the file?

fem/gslib.hpp Outdated
/// GSOPGSLIB gs = GSOPGSLIB(MPI_COMM_WORLD);
/// gs.Setup(a);
/// gs.GOP(v, GSOpType::Min);
/// would return:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return into v?

fem/gslib.hpp Outdated
virtual ~GSOPGSLIB();

// Same ids get grouped together. id == 0 does not participate.
virtual void Setup(Array<long long> &ids);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs better doxygen (can include see class description).

fem/gslib.hpp Outdated

// supported operation types
enum GSOpType {ADD, MUL, MIN, MAX};
virtual void GSOP(Vector &senddata, GSOpType op);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs better doxygen (can include see class description).

fem/gslib.hpp Outdated
enum GSOpType {ADD, MUL, MIN, MAX};
virtual void GSOP(Vector &senddata, GSOpType op);

virtual void FreeData();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What data, when should this be called?

fem/tmop.cpp Outdated
delete surf_fit_gf;
surf_fit_gf = new GridFunction(s0);
ParGridFunction *surf_fit_gf_dummy = new ParGridFunction(s0);
surf_fit_gf = surf_fit_gf_dummy;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change?

@@ -3004,33 +3012,180 @@ void TMOP_Integrator::EnableSurfaceFitting(const ParGridFunction &s0,
surf_fit_eval->SetInitialField
(*surf_fit_gf->FESpace()->GetMesh()->GetNodes(), *surf_fit_gf);
surf_fit_gf_bg = false;

// Unify marker array across processor boundaries
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would they be different?
Shouldn't this be done by the caller?

fem/tmop.cpp Outdated
fec->GetBasisType());
ParFiniteElementSpace *fes_grad = new ParFiniteElementSpace
(pmesh,
fec_grad,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this some editor malfunction?

fem/tmop.cpp Outdated
surf_fit_gf_energy += sigma_e(s) * sigma_e(s);
const IntegrationPoint &ip_s = ir_s.IntPoint(s);
Tpr->SetIntPoint(&ip_s);
surf_fit_gf_energy += surf_fit_coeff->Eval(*Tpr, ip_s) *
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought user-provided Coefficients were not part of the normalization. They would get cancelled out and have no effect.

@@ -224,14 +226,26 @@ class TMOPNewtonSolver : public LBFGSSolver
/// (ii) surface fitting weight.
virtual void ProcessNewState(const Vector &x) const;

/** @name Methods for adaptive surface fitting weight. (Experimental) */
/** @name Methods for adaptive surface fitting. These control the behavior of
the weight and the termination of the solver. (Experimental) */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need ///@{ ... ///@} to actually group the functions in the doxygen.

@kmittal2
Copy link
Member Author

After discussion with @vladotomov, I will be breaking this into smaller PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants