![]() |
Peano
|
Represents the global memory. More...
Data Structures | |
struct | Page |
Public Member Functions | |
int | totalUsedSize () const |
Take last page's start index, add its size and you get the result. | |
GlobalMemory (int initialSize) | |
int | addPage (int size) |
Add a new page of size size. | |
void | freePage (int pageNumber) |
Free a page. | |
Data Fields | |
std::vector< T > | data |
std::vector< Page > | pages |
int | additionalEntriesRequested |
Number of entries that we would have liked to have. | |
tarch::multicore::BooleanSemaphore | semaphore |
Represents the global memory.
Definition at line 169 of file GlobalContinuousMemoryPool.h.
toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory::GlobalMemory | ( | int | initialSize | ) |
Definition at line 188 of file GlobalContinuousMemoryPool.cpph.
int toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory::addPage | ( | int | size | ) |
Add a new page of size size.
This routine is not thread-safe, i.e. we rely on the calling code to have ensured that either the semaphore is locked or race conditions are not happening anyway.
Definition at line 196 of file GlobalContinuousMemoryPool.cpph.
References assertion, logDebug, logInfo, logTraceInWith1Argument, logTraceOutWith1Argument, toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory::Page::size, toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory::Page::startIndex, toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::UndefinedMemoryPage, and toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory::Page::used.
void toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory::freePage | ( | int | pageNumber | ) |
Free a page.
Set the page pageNumber to unused (boolean flag). After that, study the last page. If this one is empty - that is, if the current freePage() has freed the last page - remove it completely. This is done iteratively, as the last free could have "unlocked" a whole sequence of pages. By deleting pages at the end, we give Peano the opportunity to create new, larger or smaller pages.
Finally, we study if all pages now have been freed. If this is the case, we have the unique opportunity to grow the total memory using information about the requests that we haven't been able to serve before.
Definition at line 258 of file GlobalContinuousMemoryPool.cpph.
References assertion1, assertion3, and logInfo.
int toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory::totalUsedSize | ( | ) | const |
Take last page's start index, add its size and you get the result.
Definition at line 284 of file GlobalContinuousMemoryPool.cpph.
int toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory::additionalEntriesRequested |
Number of entries that we would have liked to have.
Definition at line 180 of file GlobalContinuousMemoryPool.h.
Referenced by toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::requestCompleteScatter().
std::vector<T> toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory::data |
Definition at line 175 of file GlobalContinuousMemoryPool.h.
Referenced by peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__generate_dastgen_input_file(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__get_file_name(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__get_full_qualified_file_name(), swift2.particle.Particle.Particle::__init__(), swift2.particle.Particle.Particle::_add_dependency_checks(), swift2.particle.Particle.Particle::_dependency_checks_modify_steps(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_boolean_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_boolean_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_double_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_double_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_enum_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_integer_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_integer_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_peano_double_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_peano_integer_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_string_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_user_defined_attributes(), peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray::_get_dictionary_for_output(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::construct_output(), peano4.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector::construct_output(), peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray::construct_output(), peano4.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::construct_output(), peano4.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::construct_output(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::get_header_file_include(), peano4.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector::get_header_file_include(), peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray::get_header_file_include(), peano4.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::get_header_file_include(), peano4.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::get_header_file_include(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::get_stack_container(), peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray::get_stack_container(), peano4.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::get_stack_container(), peano4.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::get_stack_container(), swift2.particle.Particle.Particle::readme_descriptor(), swift2.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius::set_parameters(), swift2.particle.SPHParticle.SPHParticle::set_parameters(), and swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize::set_parameters().
std::vector<Page> toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory::pages |
Definition at line 176 of file GlobalContinuousMemoryPool.h.
tarch::multicore::BooleanSemaphore toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory::semaphore |
Definition at line 181 of file GlobalContinuousMemoryPool.h.