Skip to content

About the way of inheritance #607

Answered by c-white
Z-joe0 asked this question in Q&A
Jul 24, 2024 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

The code has some inheritance in the object-oriented sense, but most of the pointers you see aren't really serving the same purpose. Rather, they are nested containers, where one container might hold multiple things, and if a subcontainer wants to change some parameter in its parent, it should do so in a way that propagates to all other subcontainers.

Consider the MeshBlock class in src/mesh/mesh.hpp. Each MeshBlock object stores all the information for a chunk of the domain. This includes coordinates and their associated routines (encapsulated in a Coordinates object), hydrodynamical variables and their associated routines (encapsulated in a Hydro object), electromagnetic fields and thei…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Z-joe0
Comment options

@c-white
Comment options

Answer selected by Z-joe0
@felker
Comment options

@Z-joe0
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #606 on July 24, 2024 22:27.