31gsMultiPatch<T> gsMultiPatch<T>::coord(
const index_t c)
const
33 gsMultiPatch<T> result;
34 for ( const_iterator it = m_patches.begin(); it != m_patches.end(); ++it )
36 result.addPatch( (*it)->coord(c) );
43 :
BaseA( geo.parDim() )
45 m_patches.push_back(geo.
clone().release());
53 :
BaseA( other ),
BaseB( other ), m_patches( other.m_patches.size() )
56 cloneAll( other.m_patches.begin(), other.m_patches.end(),
57 this->m_patches.begin());
60#if EIGEN_HAS_RVALUE_REFERENCES
68 BaseA::operator=(other);
69 m_patches.resize(other.m_patches.size());
71 cloneAll( other.m_patches.begin(), other.m_patches.end(),
72 this->m_patches.begin());
81 BaseA::operator=(
give(other));
82 m_patches =
give(other.m_patches);
91 :
BaseA( patches[0]->parDim(), patches.size() )
100 const std::vector<patchSide>&
boundary,
101 const std::vector<boundaryInterface>& interfaces )
102 :
BaseA( patches[0]->parDim(), patches.size(),
boundary, interfaces )
118 for ( iterator it = m_patches.begin(); it != m_patches.end(); ++it )
120 ( *it )->setId(
id++ );
127 if ( !this->empty() ) {
128 os <<
"gsMultiPatch (" << this->nPatches() <<
"): ";
129 os <<
"#Boundaries= " << nBoundary() <<
", ";
130 os <<
"#Interfaces= " << nInterfaces() <<
".\n";
132 os <<
"gsMultiPatch ( empty! ).\n";
140 std::ostringstream os;
142 if ( nPatches() > 0 )
152 GISMO_ASSERT( m_patches.size() > 0 ,
"Empty multipatch object.");
153 return m_patches[0]->geoDim();
159 GISMO_ASSERT( m_patches.size() > 0 ,
"Empty multipatch object.");
160 return m_patches[0]->geoDim() - m_dim;
167 return m_patches[i]->basis().support();
174 GISMO_ASSERT( i < m_patches.size(),
"Invalid patch index requested from gsMultiPatch" );
175 return m_patches[i]->basis();
181 std::vector<gsBasis<T> *> bb;
182 bb.reserve(m_patches.size());
186 for ( const_iterator it = m_patches.begin();
187 it != m_patches.end(); ++it )
189 bb.push_back( (*it)->basis().source().clone().release() );
194 for ( const_iterator it = m_patches.begin();
195 it != m_patches.end(); ++it )
197 bb.push_back( (*it)->basis().clone().release() );
219 "Tried to add a patch of different dimension in a multipatch." );
221 index_t index = m_patches.size();
223 m_patches.push_back( g.release() ) ;
231 return addPatch(g.
clone());
238 = std::find( m_patches.begin(), m_patches.end(), g );
239 GISMO_ASSERT( it != m_patches.end(),
"Did not find the patch index." );
241 return it - m_patches.begin();
248 int p1 = findPatchIndex( g1 );
249 int p2 = findPatchIndex( g2 );
250 BaseA::addInterface( p1, s1, p2, s2 );
257 m_patches[pc.patch]->eval_into(m_patches[pc.patch]->parameterCenter(pc),coordinates);
266 m_patches[ps.
patch]->eval_into(m_patches[ps.
patch]->parameterCenter(ps),coordinates);
273 for (
typename PatchContainer::const_iterator it = m_patches.begin();
274 it != m_patches.end(); ++it )
276 ( *it )->uniformRefine(numKnots, mul, dir);
284 for (
typename PatchContainer::const_iterator it = m_patches.begin();
285 it != m_patches.end(); ++it )
287 ( *it )->degreeElevate(elevationSteps, dir);
294 for (
typename PatchContainer::const_iterator it = m_patches.begin();
295 it != m_patches.end(); ++it )
297 ( *it )->degreeIncrease(elevationSteps, dir);
304 for (
typename PatchContainer::const_iterator it = m_patches.begin();
305 it != m_patches.end(); ++it )
307 ( *it )->degreeDecrease(elevationSteps, -1);
314 for (
typename PatchContainer::const_iterator it = m_patches.begin();
315 it != m_patches.end(); ++it )
317 ( *it )->degreeReduce(elevationSteps, -1);
324 for (
typename PatchContainer::const_iterator it = m_patches.begin();
325 it != m_patches.end(); ++it )
327 ( *it )->uniformCoarsen(numKnots);
334 result.setZero(geoDim(),2);
335 if ( m_patches.size() == 0 )
339 result.col(0) = patch(0).coefs().colwise().minCoeff().transpose();
340 result.col(1) = patch(0).coefs().colwise().maxCoeff().transpose();
342 for (const_iterator it = begin()+1; it != end(); ++it)
345 result.col(0) = result.col(0).cwiseMin( cc.colwise().minCoeff().transpose() ) ;
346 result.col(1) = result.col(1).cwiseMax( cc.colwise().maxCoeff().transpose() ) ;
355 n = math::exp2(parDim());
358 std::vector<gsGeometry<T>*> result;
359 result.reserve(nPatches() * n);
361 for (
size_t np = 0; np < nPatches(); ++np)
363 std::vector<gsGeometry<T>*> result_temp = m_patches[np]->uniformSplit(dir);
364 result.insert(result.end(), result_temp.begin(), result_temp.end());
367 mp.computeTopology();
379 BaseA::clearTopology();
381 const size_t np = m_patches.size();
383 const index_t nCorS = 1 << (m_dim-1);
391 coor.resize(m_dim,nCorP);
393 coor.resize(m_dim,nCorP + 2*m_dim);
398 std::vector<gsMatrix<T> > pCorners(np);
400 std::vector<patchSide> pSide;
401 pSide.reserve(np * 2 * m_dim);
404 for (
size_t p=0; p<np; ++p)
406 supp = m_patches[p]->parameterRange();
411 boxPar = c.parameters(m_dim);
413 coor(i,c-1) = boxPar(i) ? supp(i,1) : supp(i,0);
422 const index_t dir = c.direction();
426 coor(i,l) = ( dir==i ? supp(i,s) :
427 (supp(i,1)+supp(i,0))/2.0 );
433 m_patches[p]->eval_into(coor,pCorners[p]);
442 std::vector<boxCorner> cId1, cId2;
446 std::set<index_t> found;
447 for (
size_t sideind=0; sideind<pSide.size(); ++sideind)
450 for (
size_t other=sideind+1; other<pSide.
size(); ++other)
452 side .getContainedCorners(m_dim,cId1);
453 pSide[other].getContainedCorners(m_dim,cId2);
454 matched.setConstant(
false);
458 if ( ( pCorners[side.patch ].col(nCorP+side-1 ) -
459 pCorners[pSide[other].patch].col(nCorP+pSide[other]-1)
470 if ( matchVerticesOnSide( pCorners[side.patch] , cId1, 0,
471 pCorners[pSide[other].patch], cId2,
472 matched, dirMap, dirOr, tol ) )
474 dirMap(side.direction()) = pSide[other].direction();
475 dirOr (side.direction()) = !( side.parameter() == pSide[other].parameter() );
477 found.insert(sideind);
484 found.insert(found.end(), pSide.size());
485 for (
const auto & s : found)
488 BaseA::addBoundary( pSide[k] );
498 for (
typename PatchContainer::const_iterator it = m_patches.begin();
499 it != m_patches.end(); ++it )
500 if ( -1 == (*it)->orientation() )
501 (*it)->toggleOrientation();
503 if (this->nInterfaces() || this->nBoundary() )
504 this->computeTopology();
510 const gsMatrix<T> &cc2,
const std::vector<boxCorner> &ci2,
514 const bool computeOrientation = !(start&(start-1)) && (start != 0);
515 const bool setReference = start==0;
523 if (computeOrientation)
528 for (; o_dir<dim && parStart(o_dir)==parRef(o_dir) ;) ++o_dir;
532 refPar = ci2[reference].parameters(dim);
534 for (
size_t j=0;j<ci2.size();++j)
536 if( !matched(j) && (cc1.col(ci1[start]-1)-cc2.col(ci2[j]-1)).norm() < tol )
538 index_t newRef = (setReference) ? j : reference;
539 if (computeOrientation)
543 newPar = ci2[j].parameters(dim);
544 for (
index_t i=0; i< newPar.rows();++i)
546 if ( newPar(i)!=refPar(i) )
557 dirMap(o_dir) = d_dir;
558 dirO (o_dir) = (
static_cast<index_t>(j) > reference);
560 if ( start + 1 ==
static_cast<index_t>( ci1.size() ) )
565 newMatched = matched;
566 newMatched(j) =
true;
567 if (matchVerticesOnSide( cc1,ci1,start+1,cc2,ci2,newMatched,dirMap,dirO, tol,newRef))
582 std::vector<std::pair<index_t,index_t> > dof;
586 for (
index_t i = start; i!= end; ++i)
592 meanVal = m_patches[dof.front().first]->coef(dof.front().second);
593 for (
size_t k = 1; k!=dof.size(); ++k)
594 meanVal += m_patches[dof[k].first]->coef(dof[k].second);
595 meanVal.array() /= dof.size();
598 for (
size_t k = 0; k!=dof.size(); ++k)
599 m_patches[dof[k].first]->coef(dof[k].second) = meanVal;
606 const T tol2 = tol*tol;
611 const index_t sz = m_patches.size();
614 patchSizes[i] = m_patches[i]->coefsSize();
618 for ( const_iiterator it = iBegin(); it != iEnd(); ++it )
624 p1.
basis().matchWith(*it, p2.
basis(), bdr1, bdr2);
628 for (
index_t i = 0; i!= bdr1.size(); ++i )
630 if ( ( p1.
coef(bdr1(i)) - p2.
coef(bdr2(i)) ).squaredNorm() > tol2 )
634 gsWarn<<
"Big gap detected between patches "<< it->first().patch
635 <<
" and "<<it->second().patch <<
"\n";
641 mapper.
matchDof(it->first().patch, bdr1(i,0), it->second().patch, bdr2(i,0) );
657 auto pid = mesh.add_vertex_property<
index_t>(
"v:patch");
658 auto anchor = mesh.add_vertex_property<
index_t>(
"v:anchor");
660 gsSurfMesh::Point pt(0,0,0);
662 std::vector<std::pair<index_t,index_t> > pi = mapper.
anyPreImages();
669 pt.topRows(gd) = pp.
eval( pp.
basis().anchor(pi[j].second) );
670 v = mesh.add_vertex( pt );
671 pid[v] = pi[j].first;
672 anchor[v] = pi[j].second;
675 size_t np = nPatches();
684 for (
size_t p=0; p<np; ++p)
699 mesh.add_quad(v1,v2,v3,v4);
716 const T len1=box1(oDir1,1)-box1(oDir1,0);
720 box2(oDir2,0)=box2(oDir2,1);
721 box2(oDir2,1)+=scaling*len1;
725 box2(oDir2,1)=box2(oDir2,0);
726 box2(oDir2,0)-=scaling*len1;
737 for (
typename PatchContainer::const_iterator it = m_patches.begin();
738 it != m_patches.end(); ++it )
740 result.
addPatch( (*it)->approximateLinearly() );
743 result.gsBoxTopology::operator=(*this);
751 bool changed =
false;
753 std::vector<index_t> refEltsFirst;
754 std::vector<index_t> refEltsSecond;
757 switch( this->dim() )
760 changed = multiBasis.template repairInterfaceFindElements<2>( bi, refEltsFirst, refEltsSecond );
763 changed = multiBasis.template repairInterfaceFindElements<3>( bi, refEltsFirst, refEltsSecond );
772 if( refEltsFirst.size() > 0 )
775 patch(pi).basis().refineElements_withCoefs( patch(pi).coefs(), refEltsFirst );
777 if( refEltsSecond.size() > 0 )
780 patch(pi).basis().refineElements_withCoefs( patch(pi).coefs(), refEltsSecond );
794 pids.resize(points.cols());
795 pids.setConstant(-1);
796 preim.resize(parDim(), points.cols());
799 for (
index_t i = 0; i!=pids.size(); ++i)
803 for (
size_t k = 0; k!= m_patches.size(); ++k)
805 pr = m_patches[k]->parameterRange();
806 m_patches[k]->invertPoints(pt, tmp, accuracy);
807 if ( (tmp.array() >= pr.col(0).array()).all()
808 && (tmp.array() <= pr.col(1).array()).all() )
823 pid2.resize(points.cols());
824 pid2.setConstant(-1);
825 preim.resize(parDim(), points.cols());
828 for (
index_t i = 0; i!=pid2.size(); ++i)
832 for (
size_t k = 0; k!= m_patches.size(); ++k)
834 if (pid1==(
index_t)k)
continue;
836 pr = m_patches[k]->parameterRange();
837 m_patches[k]->invertPoints(pt, tmp);
838 if ( (tmp.array() >= pr.col(0).array()).all()
839 && (tmp.array() <= pr.col(1).array()).all() )
851struct __closestPointHelper
853 __closestPointHelper() : dist(math::limits::max()), pid(-1) { }
860template<
class T> std::pair<index_t,gsVector<T> >
861gsMultiPatch<T>::closestPointTo(
const gsVector<T> & pt,
862 const T accuracy)
const
864 std::pair<index_t,gsVector<T> > result;
865 this->closestDistance(pt,result,accuracy);
871T gsMultiPatch<T>::closestDistance(
const gsVector<T> & pt,
872 std::pair<
index_t,gsVector<T> > & result,
873 const T accuracy)
const
875 GISMO_ASSERT( pt.rows() == targetDim(),
"Invalid input point." <<
876 pt.rows() <<
"!="<< targetDim() );
881# pragma omp declare reduction(minimum : struct __closestPointHelper : omp_out = (omp_in.dist < omp_out.dist ? omp_in : omp_out) )
882 struct __closestPointHelper cph;
883# pragma omp parallel for default(shared) private(tmp) reduction(minimum:cph)
885 struct __closestPointHelper cph;
887 for (
size_t k = 0; k < m_patches.size(); ++k)
892 const T val = this->patch(k).closestPointTo(pt, tmp, accuracy);
901 result = std::make_pair(cph.pid,
give(cph.preim));
911 GISMO_ASSERT(this->nPatches()==other.
nPatches(),
"Number of patches should be the same, but this->nPatches()!=other.nPatches() -> "<<this->nPatches()<<
"!="<<other.
nPatches());
912 std::vector<T> result(this->nPatches());
916 const int tid = omp_get_thread_num();
917 const int nt = omp_get_num_threads();
921 for (
size_t p=tid; p<this->nPatches(); p+=nt )
923 for (
size_t p=0; p<this->nPatches(); p++ )
926 result.at(p) = this->patch(p).HausdorffDistance(other.
patch(p),nsamples,accuracy,directed);
938 std::vector<T> distances = HausdorffDistance(other,nsamples,accuracy,directed);
939 return std::accumulate(distances.begin(), distances.end(), (T)( 0 ) ) / distances.size();
943void gsMultiPatch<T>::constructInterfaceRep()
946 for ( iiterator it = iBegin(); it != iEnd(); ++it )
948 const gsGeometry<T> & p1 = *m_patches[it->first() .patch];
949 const gsGeometry<T> & p2 = *m_patches[it->second().patch];
950 m_ifaces[*it] = p1.iface(*it,p2);
958 for ( biterator it = bBegin(); it != bEnd(); ++it )
969 ifContainer ifaces = this->interfaces(l);
970 for ( iiterator it = ifaces.begin(); it != ifaces.end(); ++it )
974 m_ifaces[*it] = p1.
iface(*it,p2);
982 bContainer bdrs = this->boundaries(l);
983 for ( biterator it = bdrs.begin(); it != bdrs.end(); ++it )
993 for ( biterator it = bBegin(); it != bEnd(); ++it )
999 for ( iiterator it = iBegin(); it != iEnd(); ++it )
1001 const gsGeometry<T> & p1 = *m_patches[it->first() .patch];
1002 const gsGeometry<T> & p2 = *m_patches[it->second().patch];
1003 m_sides[it->first()] = p1.
boundary(it->first());
1004 m_sides[it->second()] = p2.boundary(it->second());
1011 GISMO_ENSURE( 2==domainDim(),
"Anything other than bivariate splines is not yet supported!");
1017 std::map<std::array<size_t, 4>, internal::ElementBlock> ElementBlocks;
1026 std::array<size_t, 4> key;
1027 std::vector<gsKnotVector<T> > kv(domainDim());
1029 for (
size_t p=0; p<nPatches(); ++p)
1041 numNodes << basis->degree(0)+1, basis->degree(1)+1 ;
1042 typename gsNewtonCotesRule<T>::uPtr QuRule;
1046 typename gsBasis<T>::domainIter domIt = basis->makeDomainIterator();
1051 auto solver = Bd.fullPivLu();
1053 for (; domIt->good(); domIt->next() )
1055 localActives = basis->active( domIt->center );
1056 globalActives.resizeLike(localActives);
1058 for (
index_t i=0; i<localActives.rows(); ++i)
1059 globalActives.
at(i) = mapper.
index(localActives.
at(i), p);
1061 key[0] = globalActives.rows();
1062 key[1] = basis->degree(0);
1063 key[2] = basis->degree(1);
1066 ElementBlocks[key].numElements += 1;
1067 ElementBlocks[key].actives.push_back(globalActives);
1068 ElementBlocks[key].PR = basis->degree(0);
1069 ElementBlocks[key].PS = basis->degree(1);
1070 ElementBlocks[key].PT = 0;
1073 QuRule->
mapTo( domIt->lowerCorner(), domIt->upperCorner(), quPoints, quWeights);
1074 basis->source().eval_into(quPoints, values);
1076 ElementBlocks[key].coefVectors.push_back(solver.solve(values.transpose()).transpose());
1080 return ElementBlocks;
1087 GISMO_ENSURE( 2==domainDim(),
"Anything other than bivariate splines is not yet supported!");
1088 std::map<std::array<size_t, 4>, internal::ElementBlock> ElementBlocks = BezierOperator();
1096 globalCoefs.setZero();
1098 globalWeights.setOnes();
1101 for (
size_t p = 0; p != this->nPatches(); p++)
1103 for (
index_t i=0; i != this->patch(p).coefs().rows(); ++i)
1105 globalCoefs.row(mapper.
index(i,p)).leftCols(this->geoDim()) = this->patch(p).coefs().row(i);
1106 if (this->basis(p).isRational())
1107 globalWeights(mapper.
index(i,p)) = this->basis(p).weights().at(i);
1111 std::vector<gsKnotVector<T> > kv(domainDim());
1113 for (
auto const& pair : ElementBlocks)
1115 internal::ElementBlock ElBlock = pair.second;
1122 auto Ait = ElBlock.actives.begin();
1123 auto Cit = ElBlock.coefVectors.begin();
1125 for(; Ait != ElBlock.actives.end() && Cit != ElBlock.coefVectors.end(); ++Ait, ++Cit)
1128 if ( (globalWeights(Ait->asVector(),0).array() != globalWeights(Ait->asVector()(0),0)).any())
1132 newWeights = Cit->transpose() * globalWeights(Ait->asVector(),0);
1133 newCoefs = Cit->transpose() * globalWeights(Ait->asVector(),0).asDiagonal() * globalCoefs(Ait->asVector(),gsEigen::all);
1134 newCoefs = newCoefs.array().colwise() / newWeights.col(0).array();
1140 Cit->transpose() * globalCoefs(Ait->asVector(),gsEigen::all) ) );
Struct which represents a certain side of a box.
Definition gsBoundary.h:85
bool parameter() const
Returns the parameter value (false=0=start, true=1=end) that corresponds to this side.
Definition gsBoundary.h:128
static boxSide getEnd(short_t dim)
helper for iterating on sides of an n-dimensional box
Definition gsBoundary.h:176
static boxSide getFirst(short_t)
helper for iterating on sides of an n-dimensional box
Definition gsBoundary.h:160
short_t direction() const
Returns the parametric direction orthogonal to this side.
Definition gsBoundary.h:113
Representation of an affine function.
Definition gsAffineFunction.h:30
Creates a mapped object or data pointer to a const vector without copying data.
Definition gsAsMatrix.h:285
Creates a mapped object or data pointer to a vector without copying data.
Definition gsAsMatrix.h:239
A univariate B-spline basis.
Definition gsBSplineBasis.h:700
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
gsSparseMatrix< T > collocationMatrix(gsMatrix< T > const &u) const
Computes the collocation matrix w.r.t. points u.
Definition gsBasis.hpp:191
virtual gsBasis::uPtr create() const
Create an empty basis of the derived type and return a pointer to it.
Definition gsBasis.hpp:532
memory::unique_ptr< gsBasis > uPtr
Unique pointer for gsBasis.
Definition gsBasis.h:89
gsMatrix< T > anchors() const
Returns the anchor points that represent the members of the basis. There is exactly one anchor point ...
Definition gsBasis.h:437
Defines a topological arrangement of a collection of "boxes" (e.g., parameter domains that map to phy...
Definition gsBoxTopology.h:39
void addAutoBoundaries()
Make all patch sides which are not yet declared as interface or boundary to a boundary.
Definition gsBoxTopology.cpp:75
void addBox(index_t i=1)
Add i new boxes.
Definition gsBoxTopology.h:198
Maintains a mapping from patch-local dofs to global dof indices and allows the elimination of individ...
Definition gsDofMapper.h:69
std::vector< std::pair< index_t, index_t > > anyPreImages(index_t comp=0) const
For all global index, this function assigns a pair (patch,dof) that maps to that global index.
Definition gsDofMapper.cpp:525
void finalize()
Must be called after all boundaries and interfaces have been marked to set up the dof numbering.
Definition gsDofMapper.cpp:240
void preImage(index_t gl, std::vector< std::pair< index_t, index_t > > &result) const
For gl being a global index, this function returns a vector of pairs (patch,dof) that contains all th...
Definition gsDofMapper.cpp:480
index_t size() const
Returns the total number of dofs (free and eliminated).
Definition gsDofMapper.h:421
void matchDof(index_t u, index_t i, index_t v, index_t j, index_t comp=0)
Couples dof i of patch u with dof j of patch v such that they refer to the same global dof at compone...
Definition gsDofMapper.cpp:99
index_t coupledSize() const
Returns the number of coupled (not eliminated) dofs.
Definition gsDofMapper.cpp:601
index_t freeSize() const
Returns the number of free (not eliminated) dofs.
Definition gsDofMapper.h:436
index_t index(index_t i, index_t k=0, index_t c=0) const
Returns the global dof index associated to local dof i of patch k.
Definition gsDofMapper.h:325
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition gsFunctionSet.h:219
uPtr clone()
Clone methode. Produceds a deep copy inside a uPtr.
gsMatrix< T > eval(const gsMatrix< T > &u) const
Evaluate the function,.
Definition gsFunctionSet.hpp:120
Abstract base class representing a geometry map.
Definition gsGeometry.h:93
std::vector< gsGeometry * > boundary() const
Get boundary of this geometry as a vector of new gsGeometry instances.
Definition gsGeometry.hpp:437
void setId(const size_t i)
Sets the patch index for this patch.
Definition gsGeometry.h:612
gsMatrix< T >::RowXpr coef(index_t i)
Returns the i-th coefficient of the geometry as a row expression.
Definition gsGeometry.h:346
memory::unique_ptr< gsGeometry > uPtr
Unique pointer for gsGeometry.
Definition gsGeometry.h:100
virtual const gsBasis< T > & basis() const =0
Returns a const reference to the basis of the geometry.
virtual gsGeometry::uPtr iface(const boundaryInterface &bi, const gsGeometry &other) const
Computes and returns the interface with other as a new geometry.
Definition gsGeometry.hpp:232
short_t parDim() const
Dimension d of the parameter domain (same as domainDim()).
Definition gsGeometry.hpp:190
Class for representing a knot vector.
Definition gsKnotVector.h:80
void initClamped(int degree, unsigned numKnots=2, unsigned mult_interior=1)
Definition gsKnotVector.hpp:693
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
T at(index_t i) const
Returns the i-th element of the vectorization of the matrix.
Definition gsMatrix.h:211
Holds a set of patch-wise bases and their topology information.
Definition gsMultiBasis.h:37
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition gsMultiPatch.h:100
bool repairInterface(const boundaryInterface &bi)
Checks if the interface is fully matching, and if not, repairs it.
Definition gsMultiPatch.hpp:748
void uniformCoarsen(int numKnots=1)
Coarsen uniformly all patches by removing numKnots in each knot-span.
Definition gsMultiPatch.hpp:322
void degreeElevate(short_t const elevationSteps=1, short_t const dir=-1)
Elevate the degree of all patches by elevationSteps, preserves smoothness.
Definition gsMultiPatch.hpp:282
void constructBoundaryRep()
Construct the boundary representation.
Definition gsMultiPatch.hpp:955
std::vector< T > HausdorffDistance(const gsMultiPatch< T > &other, const index_t nsamples=1000, const T accuracy=1e-6, const bool directed=false)
Construct the interface representation.
Definition gsMultiPatch.hpp:906
void degreeIncrease(short_t const elevationSteps=1, short_t const dir=-1)
Increase the degree of all patches by elevationSteps, preserves multiplicity.
Definition gsMultiPatch.hpp:292
PatchContainer const & patches() const
Returns a vector of patches // to do : replace by copies.
Definition gsMultiPatch.h:277
gsMultiPatch< T > approximateLinearly(index_t nsamples) const
Computes linear approximation of the patches using nsamples per direction.
Definition gsMultiPatch.hpp:733
gsMatrix< T > parameterRange(int i=0) const
Returns the range of parameter.
Definition gsMultiPatch.hpp:165
size_t findPatchIndex(gsGeometry< T > *g) const
Search for the given geometry and return its patch index.
Definition gsMultiPatch.hpp:235
std::map< std::array< size_t, 4 >, internal::ElementBlock > BezierOperator() const
Performs Bezier extraction on the multipatch.
Definition gsMultiPatch.hpp:1009
gsMatrix< T > pointOn(const patchCorner &pc)
Get coordinates of the patchCorner pc in the physical domain.
Definition gsMultiPatch.hpp:254
short_t coDim() const
Co-dimension of the geometry (must match for all patches).
Definition gsMultiPatch.hpp:157
gsAffineFunction< T > getMapForInterface(const boundaryInterface &bi, T scaling=0) const
construct the affine map that places bi.first() next to bi.second() and identifies the two matching s...
Definition gsMultiPatch.hpp:708
bool computeTopology(T tol=1e-4, bool cornersOnly=false, bool tjunctions=false)
Attempt to compute interfaces and boundaries automatically.
Definition gsMultiPatch.hpp:377
gsDofMapper getMapper(T tol) const
Used to get a mapper with unique vertices.
Definition gsMultiPatch.hpp:604
void locatePoints(const gsMatrix< T > &points, gsVector< index_t > &pids, gsMatrix< T > &preim, const T accuracy=1e-6) const
For each point in points, locates the parametric coordinates of the point.
Definition gsMultiPatch.hpp:790
index_t size() const
size
Definition gsMultiPatch.h:195
std::string detail() const
Prints the object as a string with extended details.
Definition gsMultiPatch.hpp:138
short_t geoDim() const
Dimension of the geometry (must match for all patches).
Definition gsMultiPatch.hpp:150
gsMultiPatch & operator=(gsMultiPatch other)
Assignment operator (uses copy-and-swap idiom)
Definition gsMultiPatch.h:129
gsMultiPatch()
Default empty constructor.
Definition gsMultiPatch.h:121
~gsMultiPatch()
Destructor.
Definition gsMultiPatch.hpp:109
gsGeometry< T > & patch(size_t i) const
Return the i-th patch.
Definition gsMultiPatch.h:292
index_t addPatch(typename gsGeometry< T >::uPtr g)
Add a patch from a gsGeometry<T>::uPtr.
Definition gsMultiPatch.hpp:211
void permute(const std::vector< short_t > &perm)
Permutes the patches according to perm.
Definition gsMultiPatch.hpp:204
void uniformRefine(int numKnots=1, int mul=1, short_t const dir=-1)
Refine uniformly all patches by inserting numKnots in each knot-span with multipliplicity mul.
Definition gsMultiPatch.hpp:271
void degreeReduce(int elevationSteps=1)
Reduce the degree of all patches by elevationSteps.
Definition gsMultiPatch.hpp:312
void fixOrientation()
Provides positive orientation for all patches.
Definition gsMultiPatch.hpp:496
gsBasis< T > & basis(const size_t i) const
Return the basis of the i-th patch.
Definition gsMultiPatch.hpp:172
void degreeDecrease(int elevationSteps=1)
Decrease the degree of all patches by elevationSteps.
Definition gsMultiPatch.hpp:302
void clear()
Clear (delete) all patches.
Definition gsMultiPatch.h:388
gsMultiPatch< T > uniformSplit(index_t dir=-1) const
Splits each patch uniformly in each direction (if dir = -1) into two new patches, giving a total numb...
Definition gsMultiPatch.hpp:351
void boundingBox(gsMatrix< T > &result) const
Returns a bounding box for the multipatch domain. The output result is a matrix with two columns,...
Definition gsMultiPatch.hpp:332
gsSurfMesh toMesh() const
Creates a surface mesh out of this multipatch.
Definition gsMultiPatch.hpp:652
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition gsMultiPatch.hpp:125
gsMultiPatch< T > extractBezier() const
Extracts a Bezier representation of the current gsMultiPatch object.
Definition gsMultiPatch.hpp:1085
std::vector< gsBasis< T > * > basesCopy(bool numeratorOnly=false) const
Makes a deep copy of all bases and puts them in a vector.
Definition gsMultiPatch.hpp:179
size_t nPatches() const
Number of patches.
Definition gsMultiPatch.h:274
GISMO_DEPRECATED void addInterface(gsGeometry< T > *g1, boxSide s1, gsGeometry< T > *g2, boxSide s2)
Add an interface joint between side s1 of geometry g1 side s2 of geometry g2.
Definition gsMultiPatch.hpp:245
void closeGaps(T tol=1e-4)
Attempt to close gaps between the interfaces. Assumes that the topology is computed,...
Definition gsMultiPatch.hpp:577
static uPtr make(gsVector< index_t > const &numNodes, const unsigned digits=0)
Make function returning a smart pointer.
Definition gsNewtonCotesRule.h:44
A univariate NURBS basis.
Definition gsNurbsBasis.h:40
virtual void mapTo(const gsVector< T > &lower, const gsVector< T > &upper, gsMatrix< T > &nodes, gsVector< T > &weights) const
Maps quadrature rule (i.e., points and weights) from the reference domain to an element.
Definition gsQuadRule.h:177
A halfedge data structure for polygonal meshes.
Definition gsSurfMesh.h:46
Abstract base class for tensor product bases.
Definition gsTensorBasis.h:34
unsigned index(unsigned i, unsigned j, unsigned k=0) const
Definition gsTensorBasis.h:882
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
bool nextCubePoint(Vec &cur, const Vec &end)
Iterate in lexigographic order through the points of the integer lattice contained in the cube [0,...
Definition gsCombinatorics.h:327
Implements an affine function.
Provides declaration of Basis abstract interface.
Provides combinatorial unitilies.
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
#define gsWarn
Definition gsDebug.h:50
#define GISMO_UNUSED(x)
Definition gsDebug.h:112
#define GISMO_ENSURE(cond, message)
Definition gsDebug.h:102
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
Provides the gsDofMapper class for re-indexing DoFs.
Provides declaration of Geometry abstract interface.
Represents a NURBS basis with one parameter.
Creates a variety of quadrature rules.
Half edge mesh structure.
Provides declaration of TensorBasis class.
The G+Smo namespace, containing all definitions for the library.
void cloneAll(It start, It end, ItOut out)
Clones all pointers in the range [start end) and stores new raw pointers in iterator out.
Definition gsMemory.h:295
S give(S &x)
Definition gsMemory.h:266
void freeAll(It begin, It end)
Frees all pointers in the range [begin end)
Definition gsMemory.h:312
Struct which represents an interface between two patches.
Definition gsBoundary.h:650
patchSide & first()
first, returns the first patchSide of this interface
Definition gsBoundary.h:776
patchSide & second()
second, returns the second patchSide of this interface
Definition gsBoundary.h:782
Struct that defines the boundary sides and corners and types of a geometric object.
Definition gsBoundary.h:56
Struct which represents a certain corner of a hyper-cube.
Definition gsBoundary.h:292
static boxCorner getEnd(short_t dim)
helper for iterating on corners of an n-dimensional box
Definition gsBoundary.h:372
static boxCorner getFirst(short_t)
helper for iterating on corners of an n-dimensional box
Definition gsBoundary.h:356
Definition gsSurfMesh.h:104
Struct which represents a certain corner of a patch.
Definition gsBoundary.h:393
Struct which represents a certain side of a patch.
Definition gsBoundary.h:232
index_t patch
The index of the patch.
Definition gsBoundary.h:234