Skip to content

Conversation

@cbritopacheco
Copy link
Owner

No description provided.

Copilot AI and others added 22 commits August 29, 2025 13:25
Co-authored-by: cbritopacheco <6352283+cbritopacheco@users.noreply.github.com>
Co-authored-by: cbritopacheco <6352283+cbritopacheco@users.noreply.github.com>
Co-authored-by: cbritopacheco <6352283+cbritopacheco@users.noreply.github.com>
… advection classes (#121)

* Initial plan

* Implement manufactured tests for Lagrangian and Flow advection classes

Co-authored-by: cbritopacheco <6352283+cbritopacheco@users.noreply.github.com>

* Fix

* Separate unit tests from manufactured tests and add comprehensive test suite

Co-authored-by: cbritopacheco <6352283+cbritopacheco@users.noreply.github.com>

* Update

* Update

* Fix compilation

* Change to backtrace

* Switch to forward

* Update

* Update

* Testing

* Solve with CG

* Debugging

* Update

* Update

* Update

* Fix MEDIT reading

* Add scatter functionality

* Restructure

* Rename Mapping to Pullback and InverseMapping to Pushforward

* Test

* It kinda works

* Correct orientations

* Update

* Update

* Switch to arrival form

* Remove scatter

* Manufactured tests

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: cbritopacheco <6352283+cbritopacheco@users.noreply.github.com>
Co-authored-by: cbritopacheco <carlos.brito524@gmail.com>
@github-actions github-actions bot added geometry Rodin::Geometry variational Rodin::Variational unit-tests Unit tests math Rodin::Math io Rodin::IO qf Rodin::QF labels Oct 19, 2025
@cbritopacheco cbritopacheco requested a review from Copilot October 19, 2025 20:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Introduce Lagrangian advection (semi-Lagrangian) support and flow tracing, align element/geometry conventions, and expand tests.

  • Add Variational::Flow and Advection::Lagrangian with RK integrators and manufactured/unit tests.
  • Standardize mapping terminology (Mapping→Pullback, InverseMapping→Pushforward) and update call sites.
  • Normalize quadrilateral vertex ordering and half-space definitions, adjust IO and connectivity accordingly.

Reviewed Changes

Copilot reviewed 48 out of 49 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/Rodin/Variational/Flow.h New flow tracer and function wrapper for semi-Lagrangian transport.
src/Rodin/Models/Advection/Lagrangian.h New Lagrangian advection step using Flow and CG solve.
src/Rodin/Variational/P1/P1.h Rename Mapping/InverseMapping to Pullback/Pushforward; update APIs.
src/Rodin/Variational/GridFunction.h Switch to getPullback/getPushforward in projections/evaluations.
src/Rodin/Variational/ShapeFunction.h Use Pushforward for basis eval; include cleanup.
src/Rodin/Geometry/Polytope.* Reorder quadrilateral vertices; update half-spaces and projection.
src/Rodin/Geometry/Connectivity.cpp Adjust quad/wedge edge/face connectivity to new ordering.
src/Rodin/IO/MFEM.cpp, src/Rodin/IO/MEDIT.* Align quad vertex ordering in (de)serialization; fix MEDIT value layout.
src/Rodin/QF/QFP1.* Add vertex-based P1 quadrature.
src/Rodin/QF/GaussLobato.h Add Gauss–Lobatto quadrature (filename/class spelling mismatch).
tests/* (Advection, Flow) Add unit and manufactured tests for Flow/Lagrangian.
CMakeLists.txt Lower Eigen minimum to 3.3; add new subdirectories for Advection tests/models.

Comment on lines +185 to +196
else if (poly0.getDimension() == cd - 1)
{
const Index f = poly0.getIndex();
const auto& adj = conn.getIncidence(cd - 1, cd).at(f);

if (mesh.isBoundary(f))
{
const Index c = adj[0];
mesh.getPolytopeTransformation(cd, c).inverse(s_rc_tmp, p.getPhysicalCoordinates());
Geometry::Polytope::Project(mesh.getGeometry(cd, c)).cell(s_rc, s_rc_tmp);
s_cell = c;
}
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

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

s_rc may be uninitialized or have stale size before being written in Project(...).cell(s_rc, s_rc_tmp). Resize/assign s_rc before use to avoid out-of-bounds writes. For example: s_rc = s_rc_tmp; or s_rc.resizeLike(s_rc_tmp) prior to calling cell().

Copilot uses AI. Check for mistakes.
Comment on lines +222 to +227
{
const Index c1 = adj[1];
mesh.getPolytopeTransformation(cd, c1).inverse(s_rc_tmp, p.getPhysicalCoordinates());
Geometry::Polytope::Project(mesh.getGeometry(cd, c1)).cell(s_rc, s_rc_tmp);
s_cell = c1;
}
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

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

Same issue as above: s_rc is written by Project(...).cell(s_rc, s_rc_tmp) without ensuring correct size. Initialize/resize s_rc from s_rc_tmp before the call.

Copilot uses AI. Check for mistakes.

/**
* @brief Inverse mapping for the scalar/complex P1 space.
* @brief Inverse Pullback for the scalar/complex P1 space.
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

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

The docstring says 'Inverse Pullback' but the class is 'Pushforward'. Update the comment to 'Pushforward for the scalar/complex P1 space.' to reflect the actual concept.

Suggested change
* @brief Inverse Pullback for the scalar/complex P1 space.
* @brief Pushforward for the scalar/complex P1 space.

Copilot uses AI. Check for mistakes.
Step m_step;
BoundaryPolicy m_bp;
TangentPolicy m_tp;
const Geometry::Point* m_p;
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

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

m_p is declared but never used. Consider removing it to reduce dead state and potential confusion.

Suggested change
const Geometry::Point* m_p;

Copilot uses AI. Check for mistakes.
auto getValue(const Geometry::Point& p) const
{
const auto& trace = this->trace(p);
return !(trace.exited()) * m_operand->getValue(trace.getPoint());
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

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

[nitpick] Using boolean arithmetic to zero-out values is terse but obscures intent and relies on implicit conversions. Prefer an explicit conditional for clarity: return trace.exited() ? decltype(m_operand->getValue(p)){} : m_operand->getValue(trace.getPoint()); or an if-statement.

Suggested change
return !(trace.exited()) * m_operand->getValue(trace.getPoint());
return trace.exited() ? decltype(m_operand->getValue(trace.getPoint())){} : m_operand->getValue(trace.getPoint());

Copilot uses AI. Check for mistakes.
* Copyright Carlos BRITO PACHECO 2021 - 2025.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE or copy at
* https://www.boost.org/LICENSE or copy at
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

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

The first URL is incomplete; the standard Boost license link is https://www.boost.org/LICENSE_1_0.txt. Consider removing the incomplete 'LICENSE' URL to avoid confusion.

Suggested change
* https://www.boost.org/LICENSE or copy at

Copilot uses AI. Check for mistakes.
@github-actions github-actions bot added mmg Rodin::External::MMG examples Examples labels Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples Examples geometry Rodin::Geometry io Rodin::IO math Rodin::Math mmg Rodin::External::MMG qf Rodin::QF unit-tests Unit tests variational Rodin::Variational

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants