本文整理汇总了C++中Traverse::get_base方法的典型用法代码示例。如果您正苦于以下问题:C++ Traverse::get_base方法的具体用法?C++ Traverse::get_base怎么用?C++ Traverse::get_base使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Traverse
的用法示例。
在下文中一共展示了Traverse::get_base方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assemble
//.........这里部分代码省略.........
}
//// assemble volume linear forms ////////////////////////////////////////
if (rhs != NULL)
{
for (unsigned int ww = 0; ww < s->vfvol.size(); ww++)
{
WeakForm::VectorFormVol* vfv = s->vfvol[ww];
if (isempty[vfv->i]) continue;
if (vfv->area != H2D_ANY && !wf->is_in_area(marker, vfv->area)) continue;
m = vfv->i; fv = spss[m]; am = &al[m];
for (int i = 0; i < am->cnt; i++)
{
if (am->dof[i] < 0) continue;
fv->set_active_shape(am->idx[i]);
rhs->add(am->dof[i], eval_form(vfv, u_ext, fv, refmap + m) * am->coef[i]);
}
}
}
// assemble surface integrals now: loop through boundary edges of the element
for (unsigned int edge = 0; edge < e0->nvert; edge++)
{
if (!bnd[edge]) continue;
marker = ep[edge].marker;
// obtain the list of shape functions which are nonzero on this edge
for (unsigned int i = 0; i < s->idx.size(); i++) {
if (e[i] == NULL) continue;
int j = s->idx[i];
if ((nat[j] = (spaces[j]->bc_type_callback(marker) == BC_NATURAL)))
spaces[j]->get_edge_assembly_list(e[i], edge, al + j);
}
// assemble surface matrix forms ///////////////////////////////////
if (jac != NULL)
{
for (unsigned int ww = 0; ww < s->mfsurf.size(); ww++)
{
WeakForm::MatrixFormSurf* mfs = s->mfsurf[ww];
if (isempty[mfs->i] || isempty[mfs->j]) continue;
if (mfs->area != H2D_ANY && !wf->is_in_area(marker, mfs->area)) continue;
m = mfs->i; fv = spss[m]; am = &al[m];
n = mfs->j; fu = pss[n]; an = &al[n];
if (!nat[m] || !nat[n]) continue;
ep[edge].base = trav.get_base();
ep[edge].space_v = spaces[m];
ep[edge].space_u = spaces[n];
scalar bi, **mat = get_matrix_buffer(std::max(am->cnt, an->cnt));
for (int i = 0; i < am->cnt; i++)
{
if ((k = am->dof[i]) < 0) continue;
fv->set_active_shape(am->idx[i]);
for (int j = 0; j < an->cnt; j++)
{
fu->set_active_shape(an->idx[j]);
bi = eval_form(mfs, u_ext, fu, fv, refmap+n, refmap+m, ep+edge) * an->coef[j] * am->coef[i];
if (an->dof[j] >= 0) mat[i][j] = bi;
}
}
jac->add(am->cnt, an->cnt, mat, am->dof, an->dof);
}
}
// assemble surface linear forms /////////////////////////////////////
if (rhs != NULL)
{
for (unsigned ww = 0; ww < s->vfsurf.size(); ww++)
{
WeakForm::VectorFormSurf* vfs = s->vfsurf[ww];
if (isempty[vfs->i]) continue;
if (vfs->area != H2D_ANY && !wf->is_in_area(marker, vfs->area)) continue;
m = vfs->i; fv = spss[m]; am = &al[m];
if (!nat[m]) continue;
ep[edge].base = trav.get_base();
ep[edge].space_v = spaces[m];
for (int i = 0; i < am->cnt; i++)
{
if (am->dof[i] < 0) continue;
fv->set_active_shape(am->idx[i]);
rhs->add(am->dof[i], eval_form(vfs, u_ext, fv, refmap+m, ep+edge) * am->coef[i]);
}
}
}
}
delete_cache();
}
trav.finish();
}
for (int i = 0; i < wf->neq; i++) delete spss[i];
delete [] buffer;
buffer = NULL;
mat_size = 0;
}
示例2: assemble_matrix_and_rhs
//.........这里部分代码省略.........
fu->set_active_shape(an->idx[j]);
mat[i][j] += bf->unsym(fu, fv, refmap+n, refmap+m) * coef;
}
}
}
}
// insert the local stiffness matrix into the global one
insert_matrix(mat, am->dof, an->dof, am->cnt, an->cnt);
// insert also the off-diagonal (anti-)symmetric block, if required
if (tra)
{
if (biform[n][m].unsym == BF_ANTISYM) chsgn(mat, am->cnt, an->cnt);
transpose(mat, am->cnt, an->cnt);
insert_matrix(mat, an->dof, am->dof, an->cnt, am->cnt);
// we also need to take care of the RHS...
for (j = 0; j < am->cnt; j++)
if (am->dof[j] < 0)
for (i = 0; i < an->cnt; i++)
if (an->dof[i] >= 0)
Dir[an->dof[i]] -= mat[i][j];
}
}
}
// assemble rhs (linear form)
if (!liform[m].lf) continue;
for (i = 0; i < am->cnt; i++)
{
if (am->dof[i] < 0) continue;
fv->set_active_shape(am->idx[i]);
RHS[am->dof[i]] += liform[m].lf(fv, refmap+m) * am->coef[i];
}
}
// assemble surface integrals now: loop through boundary edges of the element
if (rhsonly) continue; // fixme
for (int edge = 0; edge < e[0]->nvert; edge++)
{
if (!bnd[edge]) continue;
// obtain the list of shape functions which are nonzero on this edge
for (i = 0; i < neq; i++)
if ((nat[i] = (spaces[i]->bc_type_callback(ep[edge].marker) == BC_NATURAL)))
spaces[i]->get_edge_assembly_list(e[i], edge, al + i);
// loop through the equation-blocks
for (m = 0, am = al; m < neq; m++, am++)
{
if (!nat[m]) continue;
fv = spss[m];
ep[edge].base = trav.get_base();
ep[edge].space_v = spaces[m];
for (n = 0, an = al; n < neq; n++, an++)
{
if (!nat[n]) continue;
BiForm* bf = biform[m] + n;
if (!bf->surf) continue;
fu = pss[n];
ep[edge].space_u = spaces[n];
// assemble the surface part of the bilinear form
scalar bi, **mat = get_matrix_buffer(std::max(am->cnt, an->cnt));
for (i = 0; i < am->cnt; i++)
{
if ((k = am->dof[i]) < 0) continue;
fv->set_active_shape(am->idx[i]);
for (j = 0; j < an->cnt; j++)
{
fu->set_active_shape(an->idx[j]);
bi = bf->surf(fu, fv, refmap+n, refmap+m, ep+edge) * an->coef[j] * am->coef[i];
if (an->dof[j] >= 0) mat[i][j] = bi; else Dir[k] -= bi;
}
}
insert_matrix(mat, am->dof, an->dof, am->cnt, an->cnt);
}
// assemble the surface part of the linear form
if (!liform[m].surf) continue;
for (i = 0; i < am->cnt; i++)
{
if (am->dof[i] < 0) continue;
fv->set_active_shape(am->idx[i]);
RHS[am->dof[i]] += liform[m].surf(fv, refmap+m, ep+edge) * am->coef[i];
}
}
}
}
trav.finish();
for (i = 0; i < ndofs; i++)
RHS[i] += Dir[i];
if (!quiet) verbose(" (time: %g sec)", end_time());
for (i = 0; i < neq; i++) delete spss[i];
delete [] buffer;
delete [] refmap;
}