| 603 | } |
| 604 | |
| 605 | TFace* Allocate(const int& numberOfPoints) |
| 606 | { |
| 607 | // see if there's room for this one |
| 608 | const int polySize = FaceMemoryPool::SizeOfFace(numberOfPoints); |
| 609 | if (this->NextFaceIndex + polySize > FaceMemoryPool::ChunkSize) |
| 610 | { |
| 611 | ++this->NextChunkIndex; |
| 612 | this->NextFaceIndex = 0; |
| 613 | |
| 614 | // Although this should not happen often, check first. |
| 615 | if (this->NextChunkIndex >= this->Chunks.size()) |
| 616 | { |
| 617 | this->Chunks.resize(this->Chunks.size() * 2); |
| 618 | } |
| 619 | |
| 620 | // Next: allocate a new array if necessary. |
| 621 | if (this->Chunks[this->NextChunkIndex] == nullptr) |
| 622 | { |
| 623 | // NOLINTNEXTLINE(modernize-make-shared) |
| 624 | this->Chunks[this->NextChunkIndex] = std::shared_ptr<unsigned char>( |
| 625 | new unsigned char[FaceMemoryPool::ChunkSize], std::default_delete<unsigned char[]>()); |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | TFace* face = |
| 630 | reinterpret_cast<TFace*>(this->Chunks[this->NextChunkIndex].get() + this->NextFaceIndex); |
| 631 | face->NumberOfPoints = numberOfPoints; |
| 632 | face->PointIds = (TInputIdType*)face + FaceMemoryPool::FSizeDivSizeId; |
| 633 | this->NextFaceIndex += polySize; |
| 634 | |
| 635 | return face; |
| 636 | } |
| 637 | }; |
| 638 | |
| 639 | // This class accumulates cell array-related information. Also marks points |