Skip to content

Commit

Permalink
levelset: rework overall design
Browse files Browse the repository at this point in the history
The main purpose of the rework is to reduce the memory footprint of the
levelset. To achieve this goal, the values computed by the levelset are
stored in separate caches. Each cache can be enabled separately form the
other and can operate in one of the following modes:

    values can be cached as their are evaluated;
    values can be pre-computed inside the narrow band;
    values can be pre-computed on the whole domain.

When no caches are enabled, the only memory used by the levelset is the
memory that each object uses to store its own information (for example
the object that evaluates the levelset of a segmentation stored
information about the normals of the segmentation).

When no cached are enabled, the evaluation of the levelset is thread
safe and this allows to use the levelset object inside parallel OpenMP
regions.
  • Loading branch information
andrea-iob committed Feb 5, 2024
1 parent 693a366 commit 00fd135
Show file tree
Hide file tree
Showing 53 changed files with 8,071 additions and 7,778 deletions.
9 changes: 4 additions & 5 deletions examples/RBF_example_00001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,14 @@ void run(std::string filename,

// Set levelset configuration
bitpit::LevelSet levelset;
levelset.setPropagateSign(true);
levelset.setSizeNarrowBand(sqrt(3.0) * h);
levelset.setMesh(&mesh);

int id0 = levelset.addObject(std::move(STL0), 0);
const bitpit::LevelSetObject &object0 = levelset.getObject(id0);
std::vector<int> ids;
levelset.getObject(id0).enableVTKOutput(bitpit::LevelSetWriteField::VALUE);
levelset.setPropagateSign(true);
levelset.setSizeNarrowBand(sqrt(3.0) * h);
// Compute the levelset
levelset.compute(id0);

// Write levelset information
mesh.write();
bitpit::log::cout() << "Computed levelset within the narrow band... " << std::endl;
Expand Down
3 changes: 1 addition & 2 deletions src/levelset/bitpit_levelset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@

#include "levelSetObject.hpp"
#include "levelSetProxyObject.hpp"
#include "levelSetCachedObject.hpp"
#include "levelSetCache.hpp"
#include "levelSetSegmentationObject.hpp"
#include "levelSetSignedObject.hpp"
#include "levelSetBooleanObject.hpp"
#include "levelSetComplementObject.hpp"
#include "levelSetMaskObject.hpp"
Expand Down
Loading

0 comments on commit 00fd135

Please sign in to comment.