58 enum side { west = 1, east = 2, south = 3, north= 4, front=5, back=6,
60 left = 1, right = 2, down = 3, up = 4 , none = 0 };
65 enum corner { southwestfront = 1, southeastfront = 2, northwestfront = 3, northeastfront = 4,
66 southwestback = 5, southeastback = 6, northwestback = 7, northeastback = 8,
67 southwest = 1, southeast = 2, northwest = 3, northeast = 4
73 enum type { conforming = 0, contact = 2};
154 void getContainedCorners (
short_t dim, std::vector<boxCorner> &corners)
const;
181 boxSide& operator++ () { ++m_index;
return *
this;}
187 boxSide& operator-- () { --m_index;
return *
this;}
193 inline std::ostream &operator<<(std::ostream &os,
const boxSide& o)
222 os<<
"("<<
static_cast<int>(o)<<
")";
242 :
boxSide(s), patch(p), m_label(l) { }
245 : boxSide(s), patch(p), m_label(l) { }
248 boxSide& side() {
return *
this;}
249 const boxSide& side()
const {
return *
this;}
251 index_t patchIndex()
const {
return patch;}
252 const std::string & label()
const {
return m_label;}
253 std::string & label() {
return m_label;}
255 void setLabel(std::string label) { m_label = label; };
262 void getContainedCorners (
short_t dim, std::vector<patchCorner> &corners)
const;
268 inline std::ostream &operator<<(std::ostream &os,
patchSide const & i)
271 os<<i.
patch<<
":"<< i.side()<<
" "<<i.label();
277 inline bool operator== (
const patchSide& a,
const patchSide& b)
278 {
return a.patch == b.patch && a.m_index == b.m_index; }
279 inline bool operator< (
const patchSide& a,
const patchSide& b)
280 {
return a.patch < b.patch || (a.patch == b.patch && a.m_index < b.m_index); }
281 GISMO_DELEGATING_COMPARISON_OPERATORS(patchSide)
284 GISMO_DELETE_COMPARISON_OPERATORS(boxSide,patchSide)
302 boxCorner (gsVector<bool> v) : m_index(1)
304 for (
index_t p=0;p<v.rows();++p)
326 param(i)=((m_index-1)>>i)&1;
332 parameters_into(dim,r);
347 parameters_into(dim,param);
349 sides[i]=boxSide(i,param(i));
357 {
return boxCorner(1); }
376 boxCorner& operator++ () { ++m_index;
return *
this;}
382 boxCorner& operator-- () { --m_index;
return *
this;}
399 : boxCorner(c), patch (p) { }
402 : boxCorner(c), patch (p) { }
405 : boxCorner(c), patch (p) { }
408 boxCorner& corner() {
return *
this;}
409 const boxCorner& corner()
const {
return *
this;}
423 sides[i]=
patchSide(patch, boxSide(i, param(i)));
429 inline bool operator== (
const patchCorner& a,
const patchCorner& b)
430 {
return a.
patch == b.patch && a.m_index == b.m_index; }
431 inline bool operator< (
const patchCorner& a,
const patchCorner& b)
432 {
return a.patch < b.patch || (a.patch == b.patch && a.m_index < b.m_index); }
433 GISMO_DELEGATING_COMPARISON_OPERATORS(patchCorner)
436 GISMO_DELETE_COMPARISON_OPERATORS(boxCorner,patchCorner)
497 boxComponent( boxSide b,
short_t total_dim );
503 boxComponent( boxCorner b,
short_t total_dim );
515 std::vector<boxCorner> containedCorners()
const;
518 std::vector<boxSide> containingSides()
const;
521 boxSide asSide()
const;
524 boxCorner asCorner()
const;
527 boxComponent opposite()
const;
602 std::vector<patchCorner> containedCorners()
const;
605 std::vector<patchSide> containingSides()
const;
629 inline bool operator== (
const boxComponent& a,
const boxComponent& b)
630 {
return a.index() == b.index(); }
631 inline bool operator< (
const boxComponent& a,
const boxComponent& b)
632 {
return a.index() < b.index(); }
633 GISMO_DELEGATING_COMPARISON_OPERATORS(boxComponent)
635 inline
bool operator== (const patchComponent& a, const patchComponent& b)
636 {
return a.patch() == b.patch() && a.index() == b.index(); }
637 inline bool operator< (
const patchComponent& a,
const patchComponent& b)
638 {
return a.patch() < b.patch() || (a.patch() == b.patch() && a.index() < b.index()); }
639 GISMO_DELEGATING_COMPARISON_OPERATORS(patchComponent)
642 GISMO_DELETE_COMPARISON_OPERATORS(boxComponent,patchComponent)
652 boundaryInterface() { }
655 boundaryInterface(
patchSide const & _ps1,
658 const std::string & l =
"")
659 : m_label(l), ps1(_ps1), ps2(_ps2), m_type(interaction::conforming)
661 directionMap.resize(2);
662 directionOrientation.resize(2);
663 directionMap(ps1.direction())=ps2.direction();
664 directionMap(1-ps1.direction())=1-ps2.direction();
665 directionOrientation(ps1.direction())= (ps1.parameter()==ps2.parameter());
666 directionOrientation(1-ps1.direction())=o1;
674 const std::string & l =
"")
675 : m_label(l), ps1(_ps1), ps2(_ps2), m_type(interaction::conforming)
677 directionMap.resize(dim);
678 directionOrientation.resize(dim);
680 for (
int i = 1 ; i < dim; ++i)
682 const index_t o = (ps1.direction()+i)%dim;
683 const index_t d = (ps2.direction()+i)%dim;
686 directionOrientation(o)=
true;
689 directionMap(ps1.direction())=ps2.direction();
690 directionOrientation(ps1.direction())= (ps1.parameter()==ps2.parameter());
697 const std::string & l =
"")
698 : m_label(l), ps1(p(0),p(1)), ps2(p(2),p(3)),
699 directionMap(map_info),
700 directionOrientation(orient_flags), m_type(interaction::conforming)
703 directionMap(ps1.direction())=ps2.direction();
704 directionOrientation(ps1.direction())= (ps1.parameter()==ps2.parameter());
707 boundaryInterface(patchSide
const & _ps1,
708 patchSide
const & _ps2,
709 gsVector<index_t>
const & map_info,
710 gsVector<bool>
const & orient_flags,
711 const std::string & l =
"")
712 : m_label(l), ps1(_ps1), ps2(_ps2), directionMap(map_info), directionOrientation(orient_flags)
713 , m_type(interaction::conforming)
715 directionMap(ps1.direction())=ps2.direction();
716 directionOrientation(ps1.direction())= (ps1.parameter()==ps2.parameter());
719 GISMO_DEPRECATED boundaryInterface(patchSide
const & _ps1,
720 patchSide
const & _ps2,
721 gsVector<bool>
const & orient_flags,
722 const std::string & l =
"")
724 init(_ps1,_ps2,orient_flags,l);
727 GISMO_DEPRECATED boundaryInterface(gsVector<short_t>
const & p,
728 gsVector<bool>
const & orient_flags,
729 const std::string & l =
"")
731 init(patchSide(p(0),boxSide(p(1))),patchSide(p(2),boxSide(p(3))) ,orient_flags,l);
735 void init (patchSide
const & _ps1,
736 patchSide
const & _ps2,
737 gsVector<bool>
const & orient_flags,
738 const std::string & l =
"")
744 const index_t dim = orient_flags.cols()+1;
745 directionMap.resize(dim);
746 directionOrientation.resize(dim);
748 directionMap(ps1.direction())=ps2.direction();
749 directionOrientation(ps1.direction())= (ps1.parameter()==ps2.parameter());
751 directionMap(1-ps1.direction())=1-ps2.direction();
752 directionOrientation(1-ps1.direction())= orient_flags(0);
753 m_type = interaction::conforming;
757 const std::string &
label()
const {
return m_label;}
758 std::string & label() {
return m_label;}
761 bool operator== (
const boundaryInterface & other)
const
763 return ps1==other.ps1 && ps2==other.ps2
764 && directionMap==other.directionMap
765 && directionOrientation==other.directionOrientation;
768 inline bool operator< (
const boundaryInterface& other)
const
770 return ps1<other.ps1 || (ps1==other.ps1 && ps2<other.ps2);
777 const patchSide& first ()
const {
return ps1;}
783 const patchSide& second ()
const {
return ps2;}
793 GISMO_DEPRECATED patchSide operator [] (
size_t i)
const
800 GISMO_ERROR(
"Invalid index "<<i<<
": Interface has 2 elements(sides).");
803 GISMO_DEPRECATED patchSide & operator [] (
size_t i)
810 GISMO_ERROR(
"Invalid index "<<i<<
": Interface has 2 elements(sides).");
815 GISMO_DEPRECATED gsVector<bool> orient ()
const
817 GISMO_ASSERT(directionOrientation.size()==2,
"This is deprecated and does not work if dim>2");
818 gsVector<bool> result(1);
819 result(0)=directionOrientation(1-ps1.direction());
824 boundaryInterface getInverse()
const
826 boundaryInterface result;
827 result.directionMap.resize(directionMap.rows());
828 result.directionOrientation.resize(directionOrientation.rows());
831 result.m_type = m_type;
832 for (
index_t i=0;i<directionMap.rows();++i)
834 result.directionMap(directionMap(i))=i;
835 result.directionOrientation(directionMap(i))=directionOrientation(i);
840 patchCorner mapCorner (
const patchCorner c)
const
842 gsVector<bool> par=c.parameters(directionMap.rows());
844 gsVector<bool> new_par(dim);
845 if (c.patch == ps1.patch && par(ps1.direction()) == ps1.parameter() )
848 for (; i<ps1.direction();++i)
850 new_par(directionMap(i)) = directionOrientation(i) ?
853 new_par(directionMap(i)) = ps2.parameter();
856 new_par(directionMap(i)) = directionOrientation(i) ?
859 return patchCorner(ps2.patch, boxCorner(new_par));
861 else if (c.patch == ps2.patch && par(ps2.direction()) == ps2.parameter() )
863 return getInverse().mapCorner(c);
867 gsWarn<<
"cannot map corners that are not in the interface";
872 bool dirOrientation(
const patchSide & ps,
index_t dir)
const
875 return directionOrientation(dir);
877 return getInverse().dirOrientation(ps,dir);
883 return directionMap(dir);
885 return getInverse().dirMap(ps,dir);
892 return directionOrientation;
894 return getInverse().dirOrientation(ps);
903 return getInverse().dirMap(ps);
907 {
return directionMap; }
909 const gsVector<bool> & dirOrientation()
const
910 {
return directionOrientation; }
912 void faceData(gsVector<bool> & flip, gsVector<index_t> & perm)
const;
918 void cornerMap(gsVector<index_t> & cmap)
const;
920 void reorderCorners(gsMatrix<index_t> & boundary)
const;
922 void setAsContact() { m_type = interaction::contact; }
924 interaction::type type()
const {
return m_type; }
999 interaction::type m_type;
1004 friend std::ostream &operator<<(std::ostream &os,
const boundaryInterface & i);
1009 inline std::ostream &operator<<(std::ostream &os,
const boundaryInterface & i)
1011 os <<
"interface between "<<i.
ps1.
patch<<
":"<< i.
ps1.side()<<
" and "
1034 return ( ( s + (s+1) / 2 ) % 2 ? 1 : -1 );
1050 GISMO_ASSERT( s>0,
"Requested direction of none boundary.\n");
1071 GISMO_ASSERT( s>0,
"Requested parameter of none boundary.\n");
1072 return ( (s+1) % 2 == 0 ?
false :
true ) ;
1079 template <
typename T>
1082 GISMO_ASSERT(side.
direction()< box.rows(),
"the specified side is not appropriate for the domain dimension");
1086 temp(dir,0)=box(dir,1);
1088 temp(dir,1)=box(dir,0);
1092 #ifdef GISMO_WITH_PYBIND11
1097 void pybind11_enum_gsBoundary(pybind11::module &m);
1099 #endif // GISMO_WITH_PYBIND11
short_t totalDim() const
Dimension of the computational domain (the box itself)
Definition: gsBoundary.h:506
patchComponent(index_t p, short_t total_dim)
Constructor creating patchComponent representing the interior.
Definition: gsBoundary.h:581
index_t index() const
Returns the index.
Definition: gsBoundary.h:512
patchComponent(index_t p, boxComponent b)
Constructor converting boxComponent to a patchComponent.
Definition: gsBoundary.h:587
void parameters_into(index_t dim, gsVector< bool > ¶m) const
returns a vector of parameters describing the position of the corner
Definition: gsBoundary.h:322
index_t m_index
The index defines the component.
Definition: gsBoundary.h:477
index_t patch() const
Returns the patch number.
Definition: gsBoundary.h:626
Struct which represents a certain side of a patch.
Definition: gsBoundary.h:231
boxCorner asCorner() const
Converts to boxCorner and fails if the component is not a corner.
Definition: gsBoundary.cpp:141
gsVector< index_t > dirMap(const patchSide &ps) const
Accessor for boundaryInterface::directionMap.
Definition: gsBoundary.h:898
const std::string & label() const
Return the label.
Definition: gsBoundary.h:757
#define short_t
Definition: gsConfig.h:35
static boxSide getFirst(short_t)
helper for iterating on sides of an n-dimensional box
Definition: gsBoundary.h:160
boxComponent(index_t b, short_t total_dim)
Constructor.
Definition: gsBoundary.h:486
patchCorner asCorner() const
Converts to patchCorner and fails if the component is not a corner.
Definition: gsBoundary.h:614
patchSide & other(const patchSide &ps)
Returns the second side if ps is the first side, otherwise returns the second side.
Definition: gsBoundary.h:789
bool parameter() const
Returns the parameter value (false=0=start, true=1=end) that corresponds to this side.
Definition: gsBoundary.h:128
boxComponent opposite() const
Returns the opposite boxCorner.
Definition: gsBoundary.cpp:175
Struct that defines the boundary sides and corners and types of a geometric object.
Definition: gsBoundary.h:55
side
Identifiers for topological sides.
Definition: gsBoundary.h:58
#define index_t
Definition: gsConfig.h:32
void getContainingSides(short_t dim, std::vector< patchSide > &sides) const
returns a vector of patchSides that contain this corner
Definition: gsBoundary.h:416
gsVector< index_t > directionMap
store the combinatorial data about the interface
Definition: gsBoundary.h:988
Struct which represents a certain corner of a patch.
Definition: gsBoundary.h:392
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
std::string m_label
The label of the interface.
Definition: gsBoundary.h:927
Handles shared library creation and other class attributes.
std::string m_label
The label of the patchSide.
Definition: gsBoundary.h:236
corner
Identifiers for topological corners.
Definition: gsBoundary.h:65
patchComponent opposite() const
Returns the opposite boxCorner.
Definition: gsBoundary.h:620
static short_t index(short_t dir, bool par)
Returns the index of the box side implied by input direction dir and parameter par.
Definition: gsBoundary.h:146
static boxSide getEnd(short_t dim)
helper for iterating on sides of an n-dimensional box
Definition: gsBoundary.h:176
#define gsWarn
Definition: gsDebug.h:50
patchSide ps1
The first patch side.
Definition: gsBoundary.h:929
static boxSide getLast(short_t dim)
helper for iterating on sides of an n-dimensional box
Definition: gsBoundary.h:169
void getContainedCorners(short_t dim, std::vector< boxCorner > &corners) const
returns the vector of the corners contained in the side
Definition: gsBoundary.cpp:21
GISMO_DEPRECATED index_t direction(index_t s)
Returns the parametric direction that corresponds to side s.
Definition: gsBoundary.h:1048
gsVector< bool > directionOrientation
Definition: gsBoundary.h:996
void getContainingSides(index_t dim, std::vector< boxSide > &sides) const
returns a vector of sides containing the corner
Definition: gsBoundary.h:342
Struct which represents a certain side of a box.
Definition: gsBoundary.h:84
int sideOrientation(short_t s)
Definition: gsBoundary.h:1029
Struct which represents a certain component (interior, face, egde, corner) of a particular patch...
Definition: gsBoundary.h:565
location
Represents a location.
Definition: gsBoundary.h:530
boxSide opposite() const
returns the parallel opposite side
Definition: gsBoundary.h:134
short_t m_index
Index of the side.
Definition: gsBoundary.h:92
index_t m_patch
The particular patch.
Definition: gsBoundary.h:567
#define GISMO_ERROR(message)
Definition: gsDebug.h:118
patchSide & second()
second, returns the second patchSide of this interface
Definition: gsBoundary.h:782
This is the main header file that collects wrappers of Eigen for linear algebra.
static boxCorner getFirst(short_t)
helper for iterating on corners of an n-dimensional box
Definition: gsBoundary.h:356
patchComponent(patchCorner p, short_t total_dim)
Constructor converting patchCorner to a patchComponent.
Definition: gsBoundary.h:599
Struct which represents an interface between two patches.
Definition: gsBoundary.h:649
short_t index() const
Returns the index (as specified in boundary::side) of the box side.
Definition: gsBoundary.h:140
patchComponent(patchSide p, short_t total_dim)
Constructor converting patchSide to a patchComponent.
Definition: gsBoundary.h:593
boundaryInterface(patchSide const &_ps1, patchSide const &_ps2, short_t dim, const std::string &l="")
Definition: gsBoundary.h:671
patchComponent(index_t p, index_t b, short_t total_dim)
Constructor.
Definition: gsBoundary.h:575
static boxCorner getEnd(short_t dim)
helper for iterating on corners of an n-dimensional box
Definition: gsBoundary.h:372
boxSide asSide() const
Converts to boxSide and fails if the component is not a side.
Definition: gsBoundary.cpp:127
index_t patch
The index of the patch.
Definition: gsBoundary.h:234
gsVector< bool > dirOrientation(const patchSide &ps) const
Accessor for boundaryInterface::directionOrientation.
Definition: gsBoundary.h:889
index_t m_index
Index of the corner.
Definition: gsBoundary.h:298
Struct which represents a certain corner of a hyper-cube.
Definition: gsBoundary.h:291
gsMatrix< T > getFace(const boxSide side, const gsMatrix< T > &box)
get the matrix containing the lower and upper corner of the specified side of the given box ...
Definition: gsBoundary.h:1080
GISMO_DEPRECATED bool parameter(int s)
Returns the parameter value (false=0=start, true=1=end) that corresponds to side s.
Definition: gsBoundary.h:1069
short_t direction() const
Returns the parametric direction orthogonal to this side.
Definition: gsBoundary.h:113
static boxCorner getLast(short_t dim)
helper for iterating on corners of an n-dimensional box
Definition: gsBoundary.h:365
boxComponent(short_t total_dim)
Constructor creating boxComponent representing the interior.
Definition: gsBoundary.h:491
short_t m_total_dim
The dimension of the box itself.
Definition: gsBoundary.h:479
patchSide ps2
The second patch side.
Definition: gsBoundary.h:930
patchSide asSide() const
Converts to patchSide and fails if the component is not a corner.
Definition: gsBoundary.h:608
patchSide & first()
first, returns the first patchSide of this interface
Definition: gsBoundary.h:776
Struct which represents a certain component (interior, face, egde, corner).
Definition: gsBoundary.h:445