20 #include <gsMesh2/gsProperty.h>
43 typedef memory::shared_ptr< gsBoxTopology >
Ptr;
44 typedef memory::unique_ptr< gsBoxTopology > uPtr;
46 typedef std::vector< patchSide > bContainer;
47 typedef bContainer::iterator biterator;
48 typedef bContainer::const_iterator const_biterator;
50 typedef std::vector<boundaryInterface> ifContainer;
51 typedef ifContainer::iterator iiterator;
52 typedef ifContainer::const_iterator const_iiterator;
66 const ifContainer & interfaces )
67 : m_dim(d), nboxes(0), m_boundary(boundary), m_interfaces(interfaces)
86 std::ostream &print(std::ostream &os)
const;
103 GISMO_ASSERT(m_dim==-1 || i==m_dim,
"Changing box dimension.");
120 {
return m_interfaces.begin(); }
125 {
return m_interfaces.end(); }
130 {
return m_interfaces.begin(); }
135 {
return m_interfaces.end(); }
140 {
return m_boundary.begin(); }
145 {
return m_boundary.end(); }
150 {
return m_boundary.begin(); }
155 {
return m_boundary.end(); }
161 m_interfaces.clear();
176 std::swap( m_dim, other.
m_dim );
177 std::swap( nboxes, other.
nboxes );
194 m_interfaces.push_back( bi );
202 m_boxProp.reserve(m_boxProp.size()+i);
204 m_boxProp.push_back();
216 m_boundary.push_back( ps );
220 void addAutoBoundaries();
225 return std::find(m_boundary.begin(), m_boundary.end(), ps) != m_boundary.end();
235 bool isInterface(
const patchSide& ps)
const;
239 bContainer & boundaries() {
return m_boundary;}
245 for (const_biterator bit = bBegin(); bit!=bEnd(); bit++)
246 if (bit->label() == l)
247 result.push_back(*bit);
252 const ifContainer &
interfaces()
const {
return m_interfaces; }
253 ifContainer & interfaces() {
return m_interfaces; }
259 for (const_iiterator iit = iBegin(); iit!=iEnd(); iit++)
260 if (iit->label() == l)
261 result.push_back(*iit);
265 ifContainer selectInterfaces(interaction::type ifc_type)
const;
268 void checkConsistency()
const;
283 InterfacePtr findInterface(
const index_t b1,
const index_t b2)
const;
286 BoundaryPtr getBoundary(
const patchSide & ps);
292 for (
unsigned i = 0; i < m_interfaces.size(); ++i )
293 if ( m_interfaces[i].first() == ps || m_interfaces[i].second() == ps )
295 result = m_interfaces[i];
303 bool getCornerList(
const patchCorner& start, std::vector<patchCorner> & cornerList)
const;
306 int getMaxValence()
const;
317 std::vector< std::vector<patchComponent> > allComponents(
bool combineCorners =
false)
const;
324 void getEVs(std::vector<std::vector<patchCorner> > & cornerLists,
bool boundaries =
false)
const;
331 void getOVs(std::vector<std::vector<patchCorner> > & cornerLists)
const;
334 std::vector<std::vector<patchCorner>> vertices()
const;
347 return m_boxProp.add<T>(name,
give(t));
360 return m_boxProp.get<T>(name);
370 return m_boxProp.n_properties();
393 #ifdef GISMO_WITH_PYBIND11
398 void pybind11_init_gsBoxTopology(pybind11::module &m);
400 #endif // GISMO_WITH_PYBIND11
void addBoundary(index_t p, boxSide s, std::string l="")
Set side s of box p to a boundary.
Definition: gsBoxTopology.h:208
Struct which represents a certain side of a patch.
Definition: gsBoundary.h:231
ifContainer m_interfaces
List of intefaces between boxes.
Definition: gsBoxTopology.h:386
iiterator iBegin()
Definition: gsBoxTopology.h:129
gsBoxTopology * clone() const
Clone function. Used to make a copy of the object.
Definition: gsBoxTopology.h:78
short_t m_dim
Dimension of the boxes held.
Definition: gsBoxTopology.h:377
short_t dim() const
Dimension of the boxes.
Definition: gsBoxTopology.h:98
#define short_t
Definition: gsConfig.h:35
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsBoxTopology.cpp:40
Provides structs and classes related to interfaces and boundaries.
const bContainer & boundaries() const
Return the vector of boundaries.
Definition: gsBoxTopology.h:238
const_iiterator iBegin() const
Definition: gsBoxTopology.h:119
Struct that defines the boundary sides and corners and types of a geometric object.
Definition: gsBoundary.h:55
void setDim(short_t i)
Set the dimension of the boxes.
Definition: gsBoxTopology.h:101
const_biterator bBegin() const
Definition: gsBoxTopology.h:139
S give(S &x)
Definition: gsMemory.h:266
void addInterface(index_t p1, boxSide s1, index_t p2, boxSide s2, std::string l="")
Add an interface between side s1 of box p1 and side s2 of box p2.
Definition: gsBoxTopology.h:184
bool isBoundary(const patchSide &ps) const
Is the given patch side ps set to a boundary?
Definition: gsBoxTopology.h:223
#define index_t
Definition: gsConfig.h:32
Struct which represents a certain corner of a patch.
Definition: gsBoundary.h:392
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
Handles shared library creation and other class attributes.
gsBoxTopology(short_t d=-1, index_t n=0)
Default constructor.
Definition: gsBoxTopology.h:59
void clearTopology()
Clear all boundary and interface data.
Definition: gsBoxTopology.h:158
bool getInterface(const patchSide &ps, boundaryInterface &result) const
Definition: gsBoxTopology.h:290
memory::shared_ptr< gsBoxTopology > Ptr
Shared pointer for gsBoxTopology.
Definition: gsBoxTopology.h:43
gsProperty_container m_boxProp
List of properties for each box.
Definition: gsBoxTopology.h:389
iiterator iEnd()
Definition: gsBoxTopology.h:134
size_t nInterfaces() const
Number of interfaces.
Definition: gsBoxTopology.h:108
index_t nboxes
Number of boxes held.
Definition: gsBoxTopology.h:380
const_iiterator iEnd() const
Definition: gsBoxTopology.h:124
Struct which represents a certain side of a box.
Definition: gsBoundary.h:84
index_t nBoxes() const
Number of boxes.
Definition: gsBoxTopology.h:95
gsProperty< T > addBoxProperty(const std::string &name, T t=T())
Adds a box property.
Definition: gsBoxTopology.h:345
ifContainer interfaces(const std::string l) const
Return the vector of interfaces with label l.
Definition: gsBoxTopology.h:256
biterator bEnd()
Definition: gsBoxTopology.h:154
void addInterface(const boundaryInterface &bi)
Add an interface described by bi.
Definition: gsBoxTopology.h:192
bContainer m_boundary
List of boundaries of the boxes.
Definition: gsBoxTopology.h:383
size_t nBoundary() const
Number of boundaries.
Definition: gsBoxTopology.h:111
void swap(gsBoxTopology &other)
Swap with another gsBoxTopology.
Definition: gsBoxTopology.h:174
void clearAll()
Clear all boxes, boundary and interface data.
Definition: gsBoxTopology.h:165
bool isBoundary(index_t p, boxSide s)
Returns true if side s on patch p is a boundary.
Definition: gsBoxTopology.h:229
bContainer boundaries(const std::string l) const
Return the vector of boundaries with label l.
Definition: gsBoxTopology.h:242
void addBox(index_t i=1)
Add i new boxes.
Definition: gsBoxTopology.h:198
Struct which represents an interface between two patches.
Definition: gsBoundary.h:649
const ifContainer & interfaces() const
Return the vector of interfaces.
Definition: gsBoxTopology.h:252
const_biterator bEnd() const
Definition: gsBoxTopology.h:144
biterator bBegin()
Definition: gsBoxTopology.h:149
Defines a topological arrangement of a collection of "boxes" (e.g., parameter domains that map to phy...
Definition: gsBoxTopology.h:38
index_t numBoxProperties() const
Returns the number of assigned box properties.
Definition: gsBoxTopology.h:368
void addBoundary(const patchSide &ps)
Set patch side ps to a boundary.
Definition: gsBoxTopology.h:214
friend std::ostream & operator<<(std::ostream &os, const gsBoxTopology &b)
Print (as string) a boxTopology object.
Definition: gsBoxTopology.h:89
const boundaryInterface & bInterface(int i) const
Access i-th boundary interface.
Definition: gsBoxTopology.h:271
gsProperty< T > getBoxProperty(const std::string &name) const
Adds a box property.
Definition: gsBoxTopology.h:358