-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix QuadTree bug relating issure #32
- The QuadTree extent was not properly set for several edge containers when using domains larger than the defined constant `ContainerQuadTreeScale` - Bug has been fixed - New singleton class `TQMeshSetup` has been introduced, which handles a proper setting of QuadTree-properties behind the scenes and which can be used for the handling of further constant values
- Loading branch information
Showing
18 changed files
with
296 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,4 @@ | |
|
||
#include "MeshGenerator.h" | ||
|
||
#include "TQMeshSetup.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
* This source file is part of the tqmesh library. | ||
* This code was written by Florian Setzwein in 2022, | ||
* and is covered under the MIT License | ||
* Refer to the accompanying documentation for details | ||
* on usage and license. | ||
*/ | ||
#pragma once | ||
|
||
#include <TQMeshConfig.h> | ||
#include "STLHeaders.h" | ||
#include "CppUtils.h" | ||
|
||
namespace TQMesh { | ||
|
||
/********************************************************************* | ||
* | ||
*********************************************************************/ | ||
class TQMeshSetup { | ||
public: | ||
|
||
/*------------------------------------------------------------------ | ||
| Enforce singleton | ||
------------------------------------------------------------------*/ | ||
TQMeshSetup(const TQMeshSetup&) = delete; | ||
TQMeshSetup& operator=(const TQMeshSetup&) = delete; | ||
|
||
/*------------------------------------------------------------------ | ||
| Get singleton instance | ||
------------------------------------------------------------------*/ | ||
static TQMeshSetup& get_instance() | ||
{ | ||
static TQMeshSetup instance; | ||
return instance; | ||
} | ||
|
||
/*------------------------------------------------------------------ | ||
| Setters | ||
------------------------------------------------------------------*/ | ||
TQMeshSetup& set_quadtree_scale(double s) | ||
{ quadtree_scale_ = s; return *this; } | ||
TQMeshSetup& set_quadtree_max_items(size_t n) | ||
{ quadtree_max_items_ = n; return *this; } | ||
TQMeshSetup& set_quadtree_max_depth(size_t n) | ||
{ quadtree_max_depth_ = n; return *this; } | ||
|
||
/*------------------------------------------------------------------ | ||
| Getters | ||
------------------------------------------------------------------*/ | ||
double get_quadtree_scale() const { return quadtree_scale_; } | ||
size_t get_quadtree_max_items() const { return quadtree_max_items_; } | ||
size_t get_quadtree_max_depth() const { return quadtree_max_depth_; } | ||
|
||
private: | ||
|
||
/*------------------------------------------------------------------ | ||
| Enforce singleton | ||
------------------------------------------------------------------*/ | ||
TQMeshSetup() {} | ||
|
||
/*------------------------------------------------------------------ | ||
| | ||
------------------------------------------------------------------*/ | ||
double quadtree_scale_ { 10000.0 }; | ||
size_t quadtree_max_items_ { 100 }; | ||
size_t quadtree_max_depth_ { 25 }; | ||
|
||
}; // TQMeshSetup | ||
|
||
|
||
/********************************************************************* | ||
* | ||
*********************************************************************/ | ||
template <typename T> | ||
class ContainerFactory { | ||
public: | ||
|
||
/*------------------------------------------------------------------ | ||
| Enforce singleton | ||
------------------------------------------------------------------*/ | ||
ContainerFactory(const ContainerFactory&) = delete; | ||
ContainerFactory& operator=(const ContainerFactory&) = delete; | ||
|
||
/*------------------------------------------------------------------ | ||
| Build a new container, after initializing QuadTree properties | ||
------------------------------------------------------------------*/ | ||
static Container<T> build_container() | ||
{ | ||
TQMeshSetup& setup = TQMeshSetup::get_instance(); | ||
|
||
QuadTreeBuilder<T, double>::get_instance() | ||
.set_scale( setup.get_quadtree_scale() ) | ||
.set_max_items( setup.get_quadtree_max_items() ) | ||
.set_max_depth( setup.get_quadtree_max_depth() ); | ||
|
||
Container<T> container {}; | ||
|
||
return container; | ||
} | ||
|
||
private: | ||
|
||
/*------------------------------------------------------------------ | ||
| Enforce singleton | ||
------------------------------------------------------------------*/ | ||
ContainerFactory() {} | ||
|
||
}; // ContainerFactory | ||
|
||
|
||
} // namespace TQMesh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.