Git Product home page Git Product logo

Comments (5)

markloyman avatar markloyman commented on September 4, 2024

This problem was addressed (with a few possible solutions) at issue #22.

from poissonrecon.

andrewcomer avatar andrewcomer commented on September 4, 2024

Apologies, did not see that when searching the issues.

For the sake of completeness:
Replacing the set() method in Allocator.h with the following allows for the code to be run more than once:

void set( int blockSize )
{
    if (this->blockSize != blockSize)
    {
        reset();
        this->blockSize = blockSize;
        index = -1;
        remains = 0;
    }
}

Is there any reason this has not been added to the code outright?

from poissonrecon.

mkazhdan avatar mkazhdan commented on September 4, 2024

While this could work, I am hesitant to incorporate the fix within the code because it doesn't reallocate the memory. (Nor would it give correct behavior if the second pass used a different memory block size.)

from poissonrecon.

andrewcomer avatar andrewcomer commented on September 4, 2024

So is moving OctNode< TreeNodeData >::SetAllocator(MEMORY_ALLOCATOR_BLOCK_SIZE); above Octree< Real > tree; a more viable solution since it does reallocate the memory?

from poissonrecon.

markloyman avatar markloyman commented on September 4, 2024

Just tested it (moving SetAllocator()). This solution works for me as well, and is indeed better than my previous suggestion.

But I think a more explicit protection should be incorporated in the code (in addition to the above).

Maybe at Octree.inl add a check to see if memory was already allocated:

template< class NodeData >
void OctNode< NodeData >::SetAllocator(int blockSize)
{
	if( (blockSize>0) && (false==MemoryAlreadyAllocated))
	{
		UseAlloc=1;
		MemoryAlreadyAllocated = true;
		NodeAllocator.set(blockSize);
	}
	else{UseAlloc=0;}
}

I guess UseAlloc could've been used for this, but I think adding a new variable for this is cleaner. This is what I currently plan to do in my code.

from poissonrecon.

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.