Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4b094a9886e0
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e34006ddadf6
Choose a head ref

Commits on Oct 27, 2021

  1. Forgetting with an iterator.

    pleroy committed Oct 27, 2021
    Copy the full SHA
    8f37d55 View commit details
  2. Copy the full SHA
    cbb358a View commit details
  3. Copy the full SHA
    096d200 View commit details
  4. Iterating on empty segments.

    pleroy committed Oct 27, 2021
    Copy the full SHA
    ad30323 View commit details
  5. Merge pull request #3171 from pleroy/MinorImprovements

    Some minor improvements to trajectories
    pleroy authored Oct 27, 2021
    Copy the full SHA
    3b0ba6c View commit details
  6. Copy the full SHA
    553e833 View commit details
  7. Copy the full SHA
    ce0d285 View commit details
  8. Copy the full SHA
    763749a View commit details
  9. Splicing.

    pleroy committed Oct 27, 2021
    Copy the full SHA
    0ca5bbd View commit details
  10. Serialization.

    pleroy committed Oct 27, 2021
    Copy the full SHA
    59cabe9 View commit details
  11. Deserialization.

    pleroy committed Oct 27, 2021
    Copy the full SHA
    31ad591 View commit details
  12. After egg's review.

    pleroy committed Oct 27, 2021
    Copy the full SHA
    bf1b999 View commit details
  13. Copy the full SHA
    dfca187 View commit details
  14. Merge pull request #3172 from pleroy/EmptySegments

    Support for empty segments
    pleroy authored Oct 27, 2021
    Copy the full SHA
    551ea14 View commit details
  15. Copy the full SHA
    f1cf6e0 View commit details
  16. Readying.

    pleroy committed Oct 27, 2021
    Copy the full SHA
    37e75e5 View commit details

Commits on Oct 28, 2021

  1. Lint.

    pleroy committed Oct 28, 2021
    Copy the full SHA
    88371fb View commit details
  2. Merge pull request #3173 from pleroy/LeftEndpoints

    Change the representation of the time-to-segment map
    pleroy authored Oct 28, 2021
    Copy the full SHA
    90e49e6 View commit details
  3. Fix DeleteSegments to trim the time-to-segment map and add consistenc…

    …y checks everywhere.
    pleroy committed Oct 28, 2021
    Copy the full SHA
    337a572 View commit details
  4. Renaming.

    pleroy committed Oct 28, 2021
    Copy the full SHA
    9599904 View commit details
  5. Merge pull request #3174 from pleroy/MoreConsistency

    More consistency checks and some fixes in trajectories
    pleroy authored Oct 28, 2021
    Copy the full SHA
    f4e4462 View commit details
  6. Copy the full SHA
    e34006d View commit details
1 change: 1 addition & 0 deletions base/status_utilities.hpp
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ absl::Status const& GetStatus(absl::StatusOr<T> const& s) {
} // namespace internal_status_utilities

#define CHECK_OK(value) CHECK_EQ((value), ::absl::OkStatus())
#define DCHECK_OK(value) DCHECK_EQ((value), ::absl::OkStatus())
#define EXPECT_OK(value) \
EXPECT_THAT((value), ::principia::testing_utilities::IsOk());

44 changes: 29 additions & 15 deletions physics/discrete_traject0ry.hpp
Original file line number Diff line number Diff line change
@@ -88,8 +88,15 @@ class DiscreteTraject0ry : public Trajectory<Frame> {
SegmentIterator AttachSegments(DiscreteTraject0ry&& trajectory);
void DeleteSegments(SegmentIterator begin);

// Deletes the trajectory points with a time in [t, end[. Drops the segments
// that are empty as a result.
void ForgetAfter(Instant const& t);
void ForgetAfter(iterator it);

// Deletes the trajectory points with a time in [begin, t[. Preserves empty
// segments and doesn't invalidate any segment iterator.
void ForgetBefore(Instant const& t);
void ForgetBefore(iterator it);

void Append(Instant const& t,
DegreesOfFreedom<Frame> const& degrees_of_freedom);
@@ -116,26 +123,34 @@ class DiscreteTraject0ry : public Trajectory<Frame> {
using DownsamplingParameters =
internal_discrete_trajectory_types::DownsamplingParameters;
using Segments = internal_discrete_trajectory_types::Segments<Frame>;
using SegmentByLeftEndpoint =
absl::btree_map<Instant, typename Segments::iterator>;

// This constructor leaves the list of segments empty (but allocated) as well
// as the time-to-segment mapping.
explicit DiscreteTraject0ry(uninitialized_t);

typename Segments::iterator FindSegment(Instant const& t);
typename Segments::const_iterator FindSegment(Instant const& t) const;

// Checks if this objects is in a consistent state, and returns an error
// Returns an iterator to a segment with extremities t1 and t2 such that
// t ∈ [t1, t2[. For the last segment, t2 is assumed to be +∞. A 1-point
// segment is never returned, unless it is the last one (because its upper
// bound is assumed to be +∞). Returns segment_by_left_endpoint_->end() iff
// the trajectory is empty(). Fails if t is before the first time of the
// trajectory.
typename SegmentByLeftEndpoint::iterator FindSegment(Instant const& t);
typename SegmentByLeftEndpoint::const_iterator
FindSegment(Instant const& t) const;

// Determines if this objects is in a consistent state, and returns an error
// status with a relevant message if it isn't.
absl::Status ValidateConsistency() const;
absl::Status ConsistencyStatus() const;

// Updates the segments self-pointers and the time-to-segment mapping after
// segments have been spliced from |from| to |to|. The iterators indicate the
// segments have been spliced from |from| to |to|. The iterator indicates the
// segments to fix-up.
static void AdjustAfterSplicing(
DiscreteTraject0ry& from,
DiscreteTraject0ry& to,
typename Segments::iterator to_segments_begin,
std::reverse_iterator<typename Segments::iterator> to_segments_rend);
typename Segments::iterator to_segments_begin);

// Reads a pre-Ζήνων downsampling message and return the downsampling
// parameters and the start of the dense timeline. The latter will have to be
@@ -167,13 +182,12 @@ class DiscreteTraject0ry : public Trajectory<Frame> {
// DiscreteTrajectory moves. This field is never null and never empty.
not_null<std::unique_ptr<Segments>> segments_;

// This list is never empty. For an empty trajectory, there is a sentinel
// with time -∞ denoting the single segment of the trajectory. As soon as a
// point is appended to the trajectory, the sentinel is removed and a bona
// fide entry replaces it. To access the segment for time t, use
// |--upper_bound(t)|.
absl::btree_map<Instant,
typename Segments::iterator> segment_by_left_endpoint_;
// Maps time |t| to the last segment that start at time |t|. Does not contain
// entries for empty segments (at the beginning of the trajectory) or for
// 1-point segments that are not the last at their time. Empty iff the entire
// trajectory is empty. Always updated using |insert_or_assign| to override
// any preexisting segment with the same endpoint.
SegmentByLeftEndpoint segment_by_left_endpoint_;
};

} // namespace internal_discrete_traject0ry
Loading