概述
gsAssemblerBase 类中定义: std::vector<gsDofMapper> m_dofMappers;
这个类用来处理dirichlet边界条件,并管理多个patch内部单元的单元拓扑对应关系。
gsDofMapper的初始化:通过gsMultiBasis, gsBasis和gsBoundaryConditions进行初始化。
最常用的初始化方式是:
template<class T>
gsDofMapper(
const gsMultiBasis<T> &bases
) : m_shift(0), m_bshift(0)
{
init(bases);
}
template<class T>
void gsMultiBasis<T>::getMapper(bool conforming,
gsDofMapper & mapper,
bool finalize) const
{
mapper = gsDofMapper(*this);//.init(*this);
if ( conforming ) // Conforming boundaries ?
{
for ( gsBoxTopology::const_iiterator it = m_topology.iBegin();
it != m_topology.iEnd(); ++it )
{
matchInterface(*it,mapper);
}
}
if (finalize)
mapper.finalize();
}
template<class T>
void gsMultiBasis<T>::getMapper(bool conforming,
const gsBoundaryConditions<T> & bc,
int unk,
gsDofMapper & mapper,
bool finalize) const
{
mapper = gsDofMapper(*this, bc, unk); //.init(*this, bc, unk);
if ( conforming ) // Conforming boundaries ?
{
for ( gsBoxTopology::const_iiterator it = m_topology.iBegin();
it != m_topology.iEnd(); ++it )
{
matchInterface(*it,mapper);
}
}
if (finalize)
mapper.finalize();
}
template <typename T>
gsDofMapper* makeVectorValuedDofMapper(std::vector<const gsMultiBasis<T> *> const & bases,
gsBoundaryConditions<real_t> const & bc,
dirichlet::strategy dirStrategy)
{
//Assumes comforming patches
//GISMO_ASSERT(m_patches.nPatches() == 1,"Only implemented for single Patch");
// init dof mapper based on size of the patch spaces
index_t TarDim = bases.size();
gsDofMapper * result = new gsDofMapper(bases);
//Active_shift is a memebr of gsGenericBasisEvaluator however I do not have access to it
std::vector<unsigned> active_shift(TarDim);
active_shift[0] = 0;
for (int i = 1; i < TarDim; ++i)
active_shift[i]=active_shift[i-1]+bases[i-1]->totalSize();
//topology()
for (index_t comp = 0; comp < TarDim; ++comp)
{
for ( gsBoxTopology::const_iiterator it = bases[comp]->topology().iBegin();
it != bases[comp]->topology().iEnd(); ++it )
{
gsMatrix<unsigned> b1 = safe(bases[comp]->basis(it->first().patch).boundary( it->first().side() ))->array() + active_shift[comp];
gsMatrix<unsigned> b2 = safe(bases[comp]->basis(it->second().patch).boundary( it->second().side() ))->array() + active_shift[comp];
//result->matchInterface( it->first().patch, it->second().patch, b1, b2, it->orient());
// Note: assuming matching interfaces without transform
result->matchDofs(it->first().patch, b1, it->second().patch, b2);
}
}
// mark Dirichlet Boundaries
if(dirStrategy == dirichlet::elimination)
{
for (typename gsBoundaryConditions<T>::const_iterator it=bc.dirichletBegin();
it!=bc.dirichletEnd(); ++it)
{
for (index_t k = 0; k < TarDim; ++k)
{
gsMatrix<unsigned> dof;
gsMatrix<unsigned> *help = bases[k]->basis(it->patch()).boundary(it->ps.side());
dof = help->array() + active_shift[k];
//std::cout<< "Inside dofmapper creator number of dofs are " << dof.rows() << std::endl;
result->markBoundary(it->patch(),dof);
delete (help);
}
}
}
result->finalize();
return result;
}
最后
以上就是幸福鼠标为你收集整理的[G+smo] gsDofMapper 的使用的全部内容,希望文章能够帮你解决[G+smo] gsDofMapper 的使用所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复