17#include <gsUnstructuredSplines/src/gsC1SurfGluingData.h>
18#include <gsUnstructuredSplines/src/gsC1SurfVisitorBasisVertex.h>
24 template<
class T,
class bhVisitor = gsG1ASVisitorBasisVertex<T>>
33 std::vector<bool> isBoundary,
36 : m_mp(mp), m_basis(basis), m_isBoundary(isBoundary), m_Phi(Phi), m_gD(gluingD)
39 for (index_t dir = 0; dir < m_mp.parDim(); dir++)
46 basis_plus.elevateContinuity(1);
47 m_basis_plus.push_back(basis_plus);
50 basis_minus.degreeReduce(1);
51 m_basis_minus.push_back(basis_minus);
55 m_basis_g1 = m_basis.basis(0);
64 inline void apply(bhVisitor & visitor, index_t patchIndex);
76 constructSolution(result);
96 std::vector<bool> m_isBoundary;
103 std::vector<gsBSplineBasis<T>> m_basis_plus;
104 std::vector<gsBSplineBasis<T>> m_basis_minus;
113 std::vector<gsSparseSystem<T> > m_f;
118 std::vector<gsMatrix<T>> solVec;
123 template <
class T,
class bhVisitor>
124 void gsC1SurfBasisVertex<T,bhVisitor>::constructSolution(
gsMultiPatch<T> & result)
130 const index_t dim = ( 0!=solVec.at(0).cols() ? solVec.at(0).cols() : m_ddof[0].cols() );
133 for (index_t p = 0; p < 6; ++p)
135 const gsDofMapper & mapper = m_f.at(p).colMapper(0);
139 sz = m_basis.basis(0).size();
141 coeffs.resize(sz, dim);
143 for (index_t i = 0; i < sz; ++i)
147 coeffs.row(i) = solVec.
at(p).row(mapper.
index(i, 0));
152 coeffs.row(i) = m_ddof[0].row( mapper.
bindex(i, 0) ).head(dim);
155 result.
addPatch(m_basis_g1.basis(0).makeGeometry(
give(coeffs)));
159 template <
class T,
class bhVisitor>
160 void gsC1SurfBasisVertex<T,bhVisitor>::refresh()
172 for (index_t i = 0; i < 6; i++)
173 m_f.push_back(m_system);
177 template <
class T,
class bhVisitor>
178 void gsC1SurfBasisVertex<T,bhVisitor>::assemble()
181 const index_t nz = gsAssemblerOptions::numColNz(m_basis[0],2,1,0.333333);
182 for (
size_t i = 0; i < m_f.size(); i++)
183 m_f.at(i).reserve(nz, 1);
197 for (
size_t i = 0; i < m_f.size(); i++)
198 m_f.at(i).matrix().makeCompressed();
202 template <
class T,
class bhVisitor>
203 void gsC1SurfBasisVertex<T,bhVisitor>::apply(bhVisitor & visitor, index_t patchIndex)
216 const int tid = omp_get_thread_num();
217 const int nt = omp_get_num_threads();
228 visitor_.initialize(basis_g1, quRule);
233 typename gsBasis<T>::domainIter domIt = m_geo.basis(0).makeDomainIterator(boundary::none);
236 for ( domIt->next(tid); domIt->good(); domIt->next(nt) )
238 for (; domIt->good(); domIt->next() )
242 quRule.
mapTo( domIt->lowerCorner(), domIt->upperCorner(), quNodes, quWeights );
243#pragma omp critical(evaluate)
245 visitor_.evaluate(basis_g1, basis_geo, m_basis_plus, m_basis_minus, patch, quNodes, m_gD, m_isBoundary, m_Phi);
248 visitor_.assemble(*domIt, quWeights);
251#pragma omp critical(localToGlobal)
252 visitor_.localToGlobal(patchIndex, m_ddof, m_f);
257 template <
class T,
class bhVisitor>
258 void gsC1SurfBasisVertex<T,bhVisitor>::solve()
260 typename gsSparseSolver<T>::SimplicialLDLT solver;
266 for (index_t i = 0; i < 6; i++)
268 solver.compute(m_f.at(i).matrix());
269 solVec.push_back(solver.solve(m_f.at(i).rhs()));
The assembler class provides generic routines for volume and boundary integrals that are used for for...
Definition gsAssembler.h:266
void apply(ElementVisitor &visitor, size_t patchIndex=0, boxSide side=boundary::none)
Generic assembly routine for volume or boundary integrals.
Definition gsAssembler.h:668
virtual void assemble()
Main assemble routine, to be implemented in derived classes.
Definition gsAssembler.hpp:51
std::vector< gsMatrix< T > > m_ddof
Definition gsAssembler.h:295
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
Maintains a mapping from patch-local dofs to global dof indices and allows the elimination of individ...
Definition gsDofMapper.h:69
index_t bindex(index_t i, index_t k=0, index_t c=0) const
Returns the boundary index of local dof i of patch k.
Definition gsDofMapper.h:334
index_t boundarySize() const
Returns the number of eliminated dofs.
Definition gsDofMapper.h:457
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
bool is_free(index_t i, index_t k=0, index_t c=0) const
Returns true if local dof i of patch k is not eliminated.
Definition gsDofMapper.h:382
const gsBasis< T > & basis(const index_t k) const
Helper which casts and returns the k-th piece of this function set as a gsBasis.
Definition gsFunctionSet.hpp:33
Abstract base class representing a geometry map.
Definition gsGeometry.h:93
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
index_t addPatch(typename gsGeometry< T >::uPtr g)
Add a patch from a gsGeometry<T>::uPtr.
Definition gsMultiPatch.hpp:211
void clear()
Clear (delete) all patches.
Definition gsMultiPatch.h:388
Class representing a reference quadrature rule.
Definition gsQuadRule.h:29
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 sparse linear system indexed by sets of degrees of freedom.
Definition gsSparseSystem.h:30
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
#define index_t
Definition gsConfig.h:32
#define GISMO_NO_IMPLEMENTATION
Definition gsDebug.h:129
The G+Smo namespace, containing all definitions for the library.
S give(S &x)
Definition gsMemory.h:266