-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Untangle context from system, remove input_port_evaluator_interface #8623
Untangle context from system, remove input_port_evaluator_interface #8623
Conversation
4eee86b
to
67c304e
Compare
+@jwnimmer-tri for feature review (not a big PR) Review status: 0 of 17 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
67c304e
to
23e2f02
Compare
FYI I have spent a few hours on this already, and still will need a few more before I finish. This PR is altering some fundamental premises about how input-output wiring / responsibilities / visibility takes place, as well as altering some fundamental decisions about how system names are handled. I should be able to finish a first pass before tomorrow morning, but just be advised on that timeline. Comments from Reviewable |
Thanks, Jeremy. This and coming changes to inputs and outputs should be functionally neutral. And I didn't intend to change system names now either, just consolidate the code and move non-typed code into the non-typed base class. There was a lot of unnecessary complexity in the port handling that interfered with my ability to cache things. Next steps will be to move much of the type-erased port functionality up to the type-erased classes, and to further reduce Context's involvement in input port evaluation to just freestanding port values, which require no evaluation. Review status: 0 of 17 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
I have published some small comments in case you want to pipeline some fixes while I continue reading.
I agree that using-code is probably unaffected. It changes the design and specification for how Systems / Diagrams / Context interact with each other, and what abstractions are being chosen to partition their responsibilities. That is a design review, and needs some time from me to work through the reasoning. Reviewed 13 of 17 files at r1. systems/framework/system.h, line 405 at r1 (raw file):
Similarly, it is unclear to me how we meet our contract "Throws std::bad_cast if the port is not vector-valued". I also do not see a unit test for that promise. systems/framework/system.h, line 1352 at r1 (raw file):
At least we should ASSERT that the cast is going to succeed, since the guarantor of it is not nearby (not easy to reason about). systems/framework/system_base.h, line 38 at r1 (raw file):
Even though the comment that used to live on the Also, the GetSystemName is an override, so adding detailed semantics to its API docs that are not part of the base interface is odd, at best. systems/framework/system_base.h, line 454 at r1 (raw file):
Public methods should Doxygen style. systems/framework/system_base.h, line 454 at r1 (raw file):
FYI Re-flow this comment block? The first line is very short. systems/framework/system_base.cc, line 10 at r1 (raw file):
I originally thought that my confusion here was the lack of braces. I do think that's still a readability defect, but on second read I think the problem is that this is a for-loop written overly obscurely (too cute). I think a formulation more like this would be substantially clearer, for example: for (const SystemBase* iter = this; iter != nullptr; iter = iter->get_parent_base()) {
path_to_root.emplace(iter);
} In any case, the defect is "its too difficult to tease out what this code is doing". systems/framework/system_base.cc, line 17 at r1 (raw file):
Where is this method unit tested from? systems/framework/test/leaf_context_test.cc, line 114 at r1 (raw file):
Rule of three -- the prior 5 lines are now identical in all three methods and no longer trivial like previously, so should be factored rather than literally copied. Comments from Reviewable |
Thanks for the comments. I'd be happy to discuss the design f2f if that would be useful. Review status: 13 of 17 files reviewed at latest revision, 8 unresolved discussions. Comments from Reviewable |
BTW I should add that there really is no change here as to who does what with respect to input ports. The logic was twisty before, but if you look carefully you'll see that it went like this:
Now:
None of the actual work got moved -- I just removed Context's awkward role as a dispatcher. Review status: 13 of 17 files reviewed at latest revision, 8 unresolved discussions. Comments from Reviewable |
Responded to one small comment with a lot of code :( Review status: 10 of 17 files reviewed at latest revision, 8 unresolved discussions. systems/framework/system.h, line 405 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Sigh. These methods were already a mess when I found them -- the documentation lied and got away with it by not having any unit tests! But I guess if I touch them I own them, so PTAL now. I rewrote the documentation to provide some real contracts that are enforced, added a bunch of actually-informative error messages, and unit tested them all (in diagram_test.cc). The contracts promise to check all preconditions in Debug and state what they will do if they are also checked in Release but don't promise to do so. For now I'm checking everything but I want to be free to measure performance later and drop tests that are too expensive. We can add "OrThrow" methods then if needed. Comments from Reviewable |
Small checkpoint.
FYI You're right -- I retract my comment. Some API comment changes confused me about what was (not) being changed. Reviewed 3 of 4 files at r2. systems/framework/system.h, line 1923 at r2 (raw file):
FYI These could be marked systems/framework/system.cc, line 61 at r2 (raw file):
Methods that are templated on Possibly these could live in systems/framework/system_base.h, line 47 at r1 (raw file):
It is not clear to a reader of the API comments what the difference in semantics between After poking around at call sites and uses, I believe:
Is that correct? In any case, please update documentation somehow. (FYI Not for this PR, but I suspect that a large refactor to use "name" for log-hint-strings and "identifier" for diagram-string-keys would help clear things up a lot.) systems/framework/test/diagram_test.cc, line 624 at r2 (raw file):
This doesn't meet the BasicVector contract for subclassing (it doesn't clone correctly). At worst, it should at least comment-disclaim this, but probably it should just add the required override. (Alternatively, just re-use some existing BasicVector subclass like systems/framework/test/diagram_test.cc, line 713 at r2 (raw file):
I don't understand why the unit test code is in Comments from Reviewable |
Reviewed 1 of 4 files at r2. systems/framework/system.h, line 493 at r2 (raw file):
This "must be exactly" is perhaps too terse for BasicVector subclasses. In that case, I think we don't allow V = MyVector but rather only V = BasicVector, and then use has to do the final downcast. (In general, anything that is type-erased but cloneable would have this same question / problem.) I'd suggest this either be documented here, or else the body here could learn how to MaybeGetValue of the base clone and then downcast here for the user. (Or maybe MaybeGetValue should be taught that?) Probably document for now with a TODO for MoreMagic(tm) later? systems/framework/system.h, line 495 at r2 (raw file):
BTW s/both/all/ systems/framework/system.h, line 1037 at r2 (raw file):
This seems wrong. The method isn't ThrowIfNeg -- it's ThrowNeg -- unconditional. systems/framework/system.h, line 1412 at r2 (raw file):
Unclear why this is public. (It compiles fine as private-only.) systems/framework/system.h, line 1850 at r2 (raw file):
Methods that are diagram-specific (do not make sense for leaves) being placed onto the System class is a pretty big design defect. I think that was one of the purposes of the input_port_evaluator_interface that got the axe up above. I do not yet see why this design is better, though I am still in progress with reviewing. systems/framework/system.h, line 1944 at r2 (raw file):
BTW Unclear why we're checking systems/framework/system.h, line 1955 at r2 (raw file):
This use of dynamic_cast (as a question, rather than assumption) violates GSG. Is it only temporary, per the TODO above? Also, is it too much churn to fix the TODO as part of this PR? It seems intimately related to the design changes that are being proposed. systems/framework/system.h, line 1971 at r2 (raw file):
FYI Consider adding an up-front check and better error message if the port wasn't even declared to be vector-valued? (Rather than bailing out only after the AbstractValue dynamic cast fails.) systems/framework/system.h, line 1977 at r2 (raw file):
FYI Throughout these changes (here and above, etc.), you could add the non-reassignable Comments from Reviewable |
I've finished a first pass. I still don't understand the motivation for the evaluation responsibilities design change, and on first read it seems to explode invariants across several classes by making extra stuff public that shouldn't be. I suspect that is some true improvement / problem to be solved going on here, but I don't see it yet, and perhaps there is a more sound way to resolve it than what is proposed here. Reviewed 3 of 17 files at r1. systems/framework/context.h, line 401 at r2 (raw file):
This used to be properly hidden given the interfaces / abstractions in play. I guess I will have to revisit this choice once I understand the motivation for this design rework. systems/framework/context.h, line 406 at r2 (raw file):
This used to be properly hidden given the interfaces / abstractions in play. I guess I will have to revisit this choice once I understand the motivation for this design rework. systems/framework/system_base.h, line 447 at r2 (raw file):
FYI To me "ID" suggest a programmatic map key (identifier), not an error message string. systems/framework/system_base.h, line 454 at r2 (raw file):
BTW This probably deserves "internal use only" disclaimer or similar in its API docs. systems/framework/system_base.h, line 461 at r2 (raw file):
Public methods should use Doxygen style. systems/framework/system_base.h, line 462 at r2 (raw file):
Unclear why this is public. (It compiles fine as protected.) Comments from Reviewable |
It is a bit hard to reason about, butI'm trying to figure out what improvements take Context out of the Diagram evauation code path, but still maintain our invariants that seem to matter. I think some steps in the right direction are:
Review status: all files reviewed at latest revision, 27 unresolved discussions, some commit checks failed. Comments from Reviewable |
I think the problem is actually our idea of what invariants ought to be preserved here. The current architecture makes Diagram a second-class System, unable to acquire resources of its own, and forces us to hide Diagram functionality at the System class level. That is a mistake IMO and was very awkward to work with in caching. The SystemBase class is an attempt to rectify that to some degree and understands that there may be subsystems. We should discuss f2f. Review status: all files reviewed at latest revision, 27 unresolved discussions, some commit checks failed. Comments from Reviewable |
b2bbe7e
to
7e39157
Compare
Partial response with some code movement that looks like more changes than really happened. Review status: 10 of 18 files reviewed at latest revision, 27 unresolved discussions. systems/framework/system.h, line 495 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. systems/framework/system.h, line 1037 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. systems/framework/system.h, line 1923 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. I like that! systems/framework/system.h, line 1944 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. systems/framework/system.h, line 1971 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. systems/framework/system.h, line 1977 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. systems/framework/system.cc, line 61 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Moved to system_base.cc. In fact they have to be there soon anyway since the non-typed EvalInputPort stuff moves up to SystemBase. systems/framework/test/diagram_test.cc, line 624 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. systems/framework/test/leaf_context_test.cc, line 114 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Comments from Reviewable |
Reviewed 8 of 8 files at r3. systems/framework/system_base.h, line 482 at r3 (raw file):
FYI Do you want to promise the more specific Comments from Reviewable |
482c318
to
0c923dd
Compare
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857. Untangle output ports from system and move implementation to header.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857. Untangle output ports from system and move implementation to header.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857. Untangle output ports from system and move implementation to header.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857. Untangle output ports from system and move implementation to header.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857. Untangle output ports from system and move implementation to header.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857. Untangle output ports from system and move implementation to header.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857. Untangle output ports from system and move implementation to header.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029, dependency construction PR RobotLocomotion#9067.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029, dependency construction PR RobotLocomotion#9067.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029, dependency construction PR RobotLocomotion#9067.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029, dependency construction PR RobotLocomotion#9067.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029, dependency construction PR RobotLocomotion#9067.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029, dependency construction PR RobotLocomotion#9067.
Rearchitect fixed input ports to support invalidation. Simplified SystemOutput. Get rid of unnecessary data structures in diagram context. Moved FixInputPort to ContextBase. Convert spring-mass test to take advantage of cached derivatives. Modify depth sensor to use the cache. Add validate step in context allocation. Rename Freestanding -> Fixed. Merge changes from PRs: dependency tracker, cache, cache entry, cloneable DiagramContinuous/DiscreteState, connect base classes, output port allocator context parameter removal, PR RobotLocomotion#8623, input port PR RobotLocomotion#8760, diagram output PR RobotLocomotion#8857, output port PR RobotLocomotion#8920, output revamp PR RobotLocomotion#9028, parameter move RobotLocomotion#9029, dependency construction PR RobotLocomotion#9067.
This is the next modest-size, hopefully coherent PR from the caching branch #7668.
This removes the unnecessary dependency of Context on System for input port evaluation, and eliminates the need for the
InputPortEvaluatorInterface
. Now input ports are evaluated by the System with the Context being consulted only in the case of fixed input ports, which don't need evaluation. Lots of input port-handling code gets deleted here, and much more of it will be deleted in subsequent PRs.Scalar type-independent System name, pathname, and parent code moves up to SystemBase and some duplicated code gets the ax. More type-independent code will move up in subsequent PRs.
(The code is moving towards more even treatment of input and output ports. Think of
InputPortDescriptor
as renamed toInputPort
. I will do that after some more input port surgery.)This change is