20template<
short_t d,
class T>
21gsMappedSpline<d,T>::gsMappedSpline(
const gsMultiPatch<T> & mp,
const gsSparseMatrix<T> & m )
24 m_mbases =
new gsMappedBasis<d,T>(gsMultiBasis<T>(mp),m);
27 gsMatrix<T> local = mp.coefs();
28 m_mbases->local_coef_to_global_coef(local,m_global);
33template<
short_t d,
class T>
34gsMappedSpline<d,T>::gsMappedSpline(
const gsMappedBasis<d,T> & mbases,
const gsMatrix<T> & coefs )
38 m_mbases=mbases.clone().release();
42template<
short_t d,
class T>
43gsMappedSpline<d,T>::gsMappedSpline(
const gsMappedSpline& other )
44: gsFunctionSet<T>(), m_global(other.m_global)
46 m_mbases=other.m_mbases->clone().release();
49template<
short_t d,
class T>
50gsMappedSpline<d,T> & gsMappedSpline<d,T>::operator=(
const gsMappedSpline& other )
53 m_mbases=other.m_mbases->clone().release();
54 m_global = other.m_global;
56 for (
auto & s : m_ss) s.setSource(*this);
60template<
short_t d,
class T>
61void gsMappedSpline<d,T>::eval_into(
const unsigned patch,
const gsMatrix<T> & u, gsMatrix<T>& result )
const
63 gsMatrix<index_t> actives;
77 result.resize( N,u.cols());
79 for (
index_t k = 0; k!=u.cols(); k++)
81 m_mbases->active_into(patch,u.col(k),actives);
82 m_mbases->eval_into(patch,u.col(k),evals);
83 m_mbases->getBase(patch).linearCombination_into(m_global,actives,evals,tmp);
89template<
short_t d,
class T>
90void gsMappedSpline<d,T>::deriv_into(
const unsigned patch,
const gsMatrix<T> & u, gsMatrix<T>& result )
const
92 gsMatrix<index_t> actives;
97 result.resize( N * M,u.cols());
101 for (
index_t k = 0; k!=u.cols(); k++)
103 m_mbases->active_into(patch,u.col(k),actives);
104 m_mbases->deriv_into(patch,u.col(k),evals);
105 m_mbases->getBase(patch).linearCombination_into(m_global,actives,evals,tmp);
110template<
short_t d,
class T>
111void gsMappedSpline<d,T>::deriv2_into(
const unsigned patch,
const gsMatrix<T> & u, gsMatrix<T>& result )
const
113 gsMatrix<index_t> actives;
119 result.resize( S*N,u.cols());
122 for (
index_t k = 0; k!=u.cols(); k++)
124 m_mbases->active_into(patch,u.col(k),actives);
125 m_mbases->deriv2_into(patch,u.col(k),evals);
126 m_mbases->getBase(patch).linearCombination_into(m_global,actives,evals,tmp);
131template<
short_t d,
class T>
132void gsMappedSpline<d,T>::evalAllDers_into(
const unsigned patch,
const gsMatrix<T> & u,
133 const int n, std::vector<gsMatrix<T> >& result,
134 bool sameElement)
const
138 gsMatrix<index_t> actives;
139 std::vector< gsMatrix<T> > evals;
145 std::vector<index_t> blocksizes(3);
152 for(
int i = 0; i <= n; i++)
154 result[i].resize(blocksizes[i],u.cols());
156 for (
index_t k = 0; k!=u.cols(); k++)
158 m_mbases->active_into(patch,u.col(k),actives);
159 m_mbases->evalAllDers_into(patch,u.col(k),n,evals,sameElement);
160 m_mbases->getBase(patch).linearCombination_into(m_global,actives,evals[i],tmp);
161 result[i].col(k) = tmp;
183template<
short_t d,
class T>
184gsMultiPatch<T> gsMappedSpline<d,T>::exportToPatches()
const
187 m_mbases->global_coef_to_local_coef(m_global,local);
188 return m_mbases->exportToPatches(local);
191template<
short_t d,
class T>
192gsGeometry<T> * gsMappedSpline<d,T>::exportPatch(
int i,gsMatrix<T>
const & localCoef)
const
194 return m_mbases->exportPatch(i,localCoef);
197template<
short_t d,
class T>
198std::map<std::array<size_t, 4>, internal::ElementBlock> gsMappedSpline<d,T>::BezierOperator()
const
200 GISMO_ENSURE( 2==domainDim(),
"Anything other than bivariate splines is not yet supported!");
206 std::map<std::array<size_t, 4>, internal::ElementBlock> ElementBlocks;
209 gsMatrix<index_t> mappedActives, globalActives, localActives;
211 gsMatrix<T> coefVectors, center_point(2,1);
213 center_point.setConstant( (T)(0.5) );
216 gsMatrix<T> globalCoefs = this->getMappedCoefs();
219 gsWeightMapper<T> mapper = this->getMapper();
223 gsMatrix<> bezOperator = mapper.asMatrix().transpose();
233 gsMappedBasis<d,T> mappedBasis = this->getMappedBasis();
235 std::array<size_t, 4> key;
236 for (
size_t p=0; p<this->nPatches(); ++p)
239 mappedBasis.active_into(p, center_point,mappedActives);
242 this->getBase(p).active_into(center_point,localActives);
245 globalActives.resizeLike(localActives);
246 globalActives.setZero();
250 globalActives = mappedBasis.getGlobalIndex(p,localActives);
260 std::vector<index_t> sourceID, mappedID;
277 coefVectors.resize(mappedActives.rows(), globalActives.rows());
278 coefVectors.setZero();
282 for (
index_t i=0; i<mappedActives.rows(); ++i)
284 for (
index_t j=0; j<globalActives.rows(); ++j)
305 coefVectors(i,j) = bezOperator(mappedActives(i), globalActives(j)) ;
312 key[0] = mappedActives.rows();
313 key[1] = this->getBase(p).degree(0);
314 key[2] = this->getBase(p).degree(1);
317 ElementBlocks[key].numElements += 1;
318 ElementBlocks[key].actives.push_back(mappedActives);
319 ElementBlocks[key].PR = this->getBase(p).degree(0);
320 ElementBlocks[key].PS = this->getBase(p).degree(1);
321 ElementBlocks[key].PT = 0;
322 ElementBlocks[key].coefVectors.push_back( coefVectors );
325 return ElementBlocks;
#define index_t
Definition gsConfig.h:32
#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 Basis abstract interface.
The G+Smo namespace, containing all definitions for the library.