Thread: high-performance tree

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937

    high-performance tree

    Hello,
    I am designing an adaptive mesh refinement algorithm for approximating the solutions to differential equations involving scalar fields in two dimensions.

    I have decided to use a "refine-into-fourths" concept. Begin with a square; this is one cell. To refine this cell would give you four cells within it. Then any of those four could be refined. Thus each cell would have a unique address in terms of nesting.

    The issue is that the differential equation I am solving (Laplace's) needs to know about each cell's four adjacent cells, which might or might not be at the same level of refinement. So I'd like to be able to pop in and out of levels of refinement in constant time, like in a list.

    My idea, then is just to have something like this:
    Code:
    class cell
    {
       cell* tl;
       cell* tr;
       cell* bl;
       cell* br;
    public:
       enum child_name { top_left, top_right, bottom_left, bottom_right };
       cell* child(child_name which);
       real value() const;
       bool is_refined() const;
    };
    Is there a container that can do most of this for me already? Also, is there a better way to do this?

    Thanks.
    Last edited by CodeMonkey; 07-16-2011 at 11:48 PM.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. High Low Game with High Scores
    By Bradley Buck in forum C Programming
    Replies: 24
    Last Post: 05-27-2011, 12:42 PM
  2. Replies: 3
    Last Post: 01-17-2011, 02:09 PM
  3. Replies: 0
    Last Post: 08-25-2010, 08:04 AM
  4. High-performance call to runtime target.
    By CornedBee in forum C++ Programming
    Replies: 3
    Last Post: 09-01-2006, 06:25 PM
  5. Replies: 6
    Last Post: 06-09-2006, 12:44 AM