Coder Social home page Coder Social logo

Comments (7)

fscottfoti avatar fscottfoti commented on July 19, 2024

Yeah but there's an assertion that it can only be called once. Seems like some deeper surgery will be necessary.

from pandana.

federicofernandez avatar federicofernandez commented on July 19, 2024

Difficult to know why it doesn't just returns in case it's already initialized.
Or why it's not called from the first insert.
Perhaps configuration and initialization are done in the same call?

from pandana.

fscottfoti avatar fscottfoti commented on July 19, 2024

Well you have to tell it how many POI categories you're going to have, so this is the call that does that. Then the first call that you initialize will only initialize one category, and each successive call will initialize a category. It seems to make sense. It'd be nice to be able to change the number of categories after the first step, but that doesn't seem support by CH.

As for the assertion, don't those only exist when compiled in debug mode?

from pandana.

fscottfoti avatar fscottfoti commented on July 19, 2024

Looks like that we need to solve this in order to solve #73. When I look at the code, I wonder why we can't just reinitialize an element of poiIndexArray, or even make it longer or shorter. Is it more complicated than that? It very well might be - I didn't look too much deeper than that. Remember Dennis just did this work in a few days so maybe he just didn't want to add the methods and do the error checking to modify the array...

from pandana.

fscottfoti avatar fscottfoti commented on July 19, 2024

Fede, if you look at #81 I started re-initialize the POI indexes in order to solve #73. It seems to work ok, so I think what you were discussing here should work - you shouldn't have to call init_pois.

from pandana.

federicofernandez avatar federicofernandez commented on July 19, 2024

Right. What you say seems to be right.

As always, with C++ it's often difficult to understand all the container / memory handling until you get to the last line of the code and check that there are no strange allocations, but it doesn't seem to be the case.

In principle, two comments:

  1. The poiIndexArray is a std::vector, so it's totally safe to add / remove / replace objects, as defined here.

  2. The other important point is the class of the elements contained in that structure. Of course, they are of type POIIndexArray. I looked a bit into the constructor and destructor and in principle there's nothing to worry about. The same about the members of the class, there are two std::shared_ptrs that should take care of their memory well, and there is a pointer to the graph that AFAIK won't be an issue at destruction time.

from pandana.

fscottfoti avatar fscottfoti commented on July 19, 2024

Fixed by #87

from pandana.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.