G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsHBoxUtils.h
Go to the documentation of this file.
1
14#pragma once
15
16
17#include <iostream>
18
19namespace gismo
20{
21
25enum class gsHNeighborhood
26{
27 None = -1,
28 Automatic = 0,
29 T = 1,
30 H = 2
31};
32
44template<short_t d, class T>
46{
47protected:
48 typedef typename gsHBox<d,T>::Container Container;
49 typedef typename gsHBox<d,T>::SortedContainer SortedContainer;
50 typedef typename gsHBox<d,T>::HContainer HContainer;
51 typedef typename gsHBox<d,T>::Iterator Iterator;
52 typedef typename gsHBox<d,T>::cIterator cIterator;
53 typedef typename gsHBox<d,T>::rIterator rIterator;
54 typedef typename gsHBox<d,T>::HIterator HIterator;
55 typedef typename gsHBox<d,T>::cHIterator cHIterator;
56 typedef typename gsHBox<d,T>::rHIterator rHIterator;
57
58public:
59 static typename gsHBox<d, T>::SortedContainer Sort(const Container & container);
60 static typename gsHBox<d, T>::Container Unique(const Container & container);
61 static typename gsHBox<d, T>::HContainer Unique(const HContainer & container);
62 static gsHBoxContainer<d, T> Unique(const gsHBoxContainer<d,T> & container);
63
64 static typename gsHBox<d, T>::Container Union(const Container & container1, const Container & container2);
65 static typename gsHBox<d, T>::HContainer Union(const HContainer & container1, const HContainer & container2);
66 static gsHBoxContainer<d, T> Union(const gsHBoxContainer<d,T> & container1, const gsHBoxContainer<d,T> & container2);
67 // Takes the difference container1 \ container2
68 static typename gsHBox<d, T>::Container Difference(const Container & container1, const Container & container2);
69 static typename gsHBox<d, T>::HContainer Difference(const HContainer & container1, const HContainer & container2);
70 static gsHBoxContainer<d, T> Difference(const gsHBoxContainer<d,T> & container1, const gsHBoxContainer<d,T> & container2);
82 static typename gsHBox<d, T>::Container Intersection(const Container & container1, const Container & container2);
83 static typename gsHBox<d, T>::Container ContainedIntersection(const Container & container1, const Container & container2);
95 static typename gsHBox<d, T>::Container ExactIntersection(const Container & container1, const Container & container2);
96 // typename gsHBox<d, T>::Container gsHBoxIntersection(const gsHBox<d,T> & box1, const gsHBox<d,T> & box2)
97
98 static Container HContainer2Container( const HContainer & container );
99 static HContainer Container2HContainer( const Container & container );
100
106 static Container toContainer(const HContainer & container);
107
115 static Container toUnitBoxes(const HContainer & container);
116
124 static HContainer toUnitHBoxes(const HContainer & container);
125
134 static HContainer markTadmissible(const HContainer & marked, index_t m);
135
144 static HContainer markTadmissible(const gsHBox<d,T> & marked, index_t m);
145
154 static HContainer markHadmissible(const HContainer & marked, index_t m);
155
164 static HContainer markHadmissible(const gsHBox<d,T> & marked, index_t m);
165
174 template<gsHNeighborhood _mode>
175 static HContainer markAdmissible(const gsHBox<d,T> & marked, index_t m);
176 template<gsHNeighborhood _mode>
177 static HContainer markAdmissible(const HContainer & marked, index_t m);
178
179 static HContainer markAdmissible(const gsHBox<d,T> & marked, index_t m);
180 static HContainer markAdmissible(const HContainer & marked, index_t m);
181
182 static bool allActive(const Container & elements);
183 static bool allActive(const HContainer & elements);
184
185 static gsHNeighborhood neighborhoodType(const gsHBox<d,T> & box);
186
187protected:
199 template<gsHNeighborhood _mode>
200 static
201 typename std::enable_if<_mode==gsHNeighborhood::T || _mode==gsHNeighborhood::H, HContainer>::type
202 _markRecursive(const HContainer & marked, index_t lvl, index_t m);
203
204 template<gsHNeighborhood _mode>
205 static
206 typename std::enable_if<_mode!=gsHNeighborhood::T && _mode!=gsHNeighborhood::H, HContainer>::type
207 _markRecursive(const HContainer & marked, index_t lvl, index_t m);
208};
209
210template <short_t d, class T>
211struct gsHBoxCompare
212{
213 bool operator()(const gsHBox<d,T> & a, const gsHBox<d,T> & b) const;
214};
215
216template <short_t d, class T>
217struct gsHBoxEqual
218{
219 bool operator()(const gsHBox<d,T> & a, const gsHBox<d,T> & b) const;
220};
221
222// template <short_t d, class T>
223// struct gsHBoxOverlaps
224// {
225// bool operator()(const gsHBox<d,T> & a, const gsHBox<d,T> & b) const;
226// };
227
228template <short_t d, class T>
229struct gsHBoxContains
230{
231 bool operator()(const gsHBox<d,T> & a, const gsHBox<d,T> & b) const;
232};
233
234template <short_t d, class T>
235struct gsHBoxIsContained
236{
237 bool operator()(const gsHBox<d,T> & a, const gsHBox<d,T> & b) const;
238};
239
240
241} // namespace gismo
242
243#ifndef GISMO_BUILD_LIB
244#include GISMO_HPP_HEADER(gsHBoxUtils.hpp)
245#endif
The Hierarchical Box Container provides a container for gsHBox objects.
Definition gsHBoxContainer.h:40
This class provides a Hierarchical Box (gsHBox)
Definition gsHBox.h:55
#define index_t
Definition gsConfig.h:32
The G+Smo namespace, containing all definitions for the library.
gsHNeighborhood
The gsHNeighborhood is a struct that classifies the type of admissible refinement.
Definition gsHBoxUtils.h:26
The gsHBoxUtils provide basic utilities to modify HBoxes.
Definition gsHBoxUtils.h:46
static Container toContainer(const HContainer &container)
Returns a container representation of the object.
Definition gsHBoxUtils.hpp:352
static std::enable_if< _mode==gsHNeighborhood::T||_mode==gsHNeighborhood::H, HContainer >::type _markRecursive(const HContainer &marked, index_t lvl, index_t m)
Marks Recursively.
Definition gsHBoxUtils.hpp:429
static HContainer markTadmissible(const HContainer &marked, index_t m)
Performs T-admissible refinement.
Definition gsHBoxUtils.hpp:401
static gsHBox< d, T >::Container ExactIntersection(const Container &container1, const Container &container2)
Performs an intersection; only keeps the boxes that are EXACTLY the same (also level is the same)
Definition gsHBoxUtils.hpp:273
static gsHBox< d, T >::Container Intersection(const Container &container1, const Container &container2)
Performs an intersection. Keeps the smallest boxes in overlapping regions, can also intersect partial...
Definition gsHBoxUtils.hpp:214
static Container toUnitBoxes(const HContainer &container)
Transforms the boxes in container as unit boxes.
Definition gsHBoxUtils.hpp:366
static HContainer toUnitHBoxes(const HContainer &container)
Transforms the boxes in container as unit boxes.
Definition gsHBoxUtils.hpp:383
static HContainer markAdmissible(const gsHBox< d, T > &marked, index_t m)
Performs H-admissible refinement.
Definition gsHBoxUtils.hpp:474
static HContainer markHadmissible(const HContainer &marked, index_t m)
Performs H-admissible refinement.
Definition gsHBoxUtils.hpp:414