本文整理汇总了C++中Func::free_ord方法的典型用法代码示例。如果您正苦于以下问题:C++ Func::free_ord方法的具体用法?C++ Func::free_ord怎么用?C++ Func::free_ord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func::free_ord方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eval_error
scalar HcurlOrthoHP::eval_error(biform_val_t bi_fn, biform_ord_t bi_ord,
MeshFunction *sln1, MeshFunction *sln2, MeshFunction *rsln1, MeshFunction *rsln2,
RefMap *rv1, RefMap *rv2, RefMap *rrv1, RefMap *rrv2)
{
// determine the integration order
int inc = (rsln1->get_num_components() == 2) ? 1 : 0;
Func<Ord>* ou = init_fn_ord(rsln1->get_fn_order() + inc);
Func<Ord>* ov = init_fn_ord(rsln2->get_fn_order() + inc);
double fake_wt = 1.0;
Geom<Ord>* fake_e = init_geom_ord();
Ord o = bi_ord(1, &fake_wt, ou, ov, fake_e, NULL);
int order = rrv1->get_inv_ref_order();
order += o.get_order();
limit_order(order);
ou->free_ord(); delete ou;
ov->free_ord(); delete ov;
delete fake_e;
// eval the form
Quad2D* quad = sln1->get_quad_2d();
double3* pt = quad->get_points(order);
int np = quad->get_num_points(order);
// init geometry and jacobian*weights
Geom<double>* e = init_geom_vol(rrv1, order);
double* jac = rrv1->get_jacobian(order);
double* jwt = new double[np];
for(int i = 0; i < np; i++)
jwt[i] = pt[i][2] * jac[i];
// function values and values of external functions
Func<scalar>* err1 = init_fn(sln1, rv1, order);
Func<scalar>* err2 = init_fn(sln2, rv2, order);
Func<scalar>* v1 = init_fn(rsln1, rrv1, order);
Func<scalar>* v2 = init_fn(rsln2, rrv2, order);
for (int i = 0; i < np; i++)
{
err1->val0[i] = err1->val0[i] - v1->val0[i];
err1->val1[i] = err1->val1[i] - v1->val1[i];
err1->curl[i] = err1->curl[i] - v1->curl[i];
err2->val0[i] = err2->val0[i] - v2->val0[i];
err2->val1[i] = err2->val1[i] - v2->val1[i];
err2->curl[i] = err2->curl[i] - v2->curl[i];
}
scalar res = bi_fn(np, jwt, err1, err2, e, NULL);
e->free(); delete e;
delete [] jwt;
err1->free_fn(); delete err1;
err2->free_fn(); delete err2;
v1->free_fn(); delete v1;
v2->free_fn(); delete v2;
return res;
}
示例2: eval_form
// Actual evaluation of volume matrix form (calculates integral)
scalar FeProblem::eval_form(WeakForm::MatrixFormVol *mfv, Tuple<Solution *> u_ext, PrecalcShapeset *fu, PrecalcShapeset *fv, RefMap *ru, RefMap *rv)
{
// determine the integration order
int inc = (fu->get_num_components() == 2) ? 1 : 0;
AUTOLA_OR(Func<Ord>*, oi, wf->neq);
for (int i = 0; i < wf->neq; i++) oi[i] = init_fn_ord(u_ext[i]->get_fn_order() + inc);
Func<Ord>* ou = init_fn_ord(fu->get_fn_order() + inc);
Func<Ord>* ov = init_fn_ord(fv->get_fn_order() + inc);
ExtData<Ord>* fake_ext = init_ext_fns_ord(mfv->ext);
double fake_wt = 1.0;
Geom<Ord>* fake_e = init_geom_ord();
Ord o = mfv->ord(1, &fake_wt, oi, ou, ov, fake_e, fake_ext);
int order = ru->get_inv_ref_order();
order += o.get_order();
limit_order_nowarn(order);
for (int i = 0; i < wf->neq; i++) { oi[i]->free_ord(); delete oi[i]; }
ou->free_ord(); delete ou;
ov->free_ord(); delete ov;
delete fake_e;
fake_ext->free_ord(); delete fake_ext;
// eval the form
Quad2D* quad = fu->get_quad_2d();
double3* pt = quad->get_points(order);
int np = quad->get_num_points(order);
// init geometry and jacobian*weights
if (cache_e[order] == NULL)
{
cache_e[order] = init_geom_vol(ru, order);
double* jac = ru->get_jacobian(order);
cache_jwt[order] = new double[np];
for(int i = 0; i < np; i++)
cache_jwt[order][i] = pt[i][2] * jac[i];
}
Geom<double>* e = cache_e[order];
double* jwt = cache_jwt[order];
// function values and values of external functions
AUTOLA_OR(Func<scalar>*, prev, wf->neq);
for (int i = 0; i < wf->neq; i++) prev[i] = init_fn(u_ext[i], rv, order);
Func<double>* u = get_fn(fu, ru, order);
Func<double>* v = get_fn(fv, rv, order);
ExtData<scalar>* ext = init_ext_fns(mfv->ext, rv, order);
scalar res = mfv->fn(np, jwt, prev, u, v, e, ext);
for (int i = 0; i < wf->neq; i++) { prev[i]->free_fn(); delete prev[i]; }
ext->free(); delete ext;
return res;
}
示例3: eval_solution_norm
double KellyTypeAdapt::eval_solution_norm(Adapt::MatrixFormVolError* form, RefMap *rm, MeshFunction* sln)
{
// determine the integration order
int inc = (sln->get_num_components() == 2) ? 1 : 0;
Func<Ord>* ou = init_fn_ord(sln->get_fn_order() + inc);
double fake_wt = 1.0;
Geom<Ord>* fake_e = init_geom_ord();
Ord o = form->ord(1, &fake_wt, NULL, ou, ou, fake_e, NULL);
int order = rm->get_inv_ref_order();
order += o.get_order();
Solution *sol = static_cast<Solution *>(sln);
if(sol && sol->get_type() == HERMES_EXACT) {
limit_order_nowarn(order);
}
else {
limit_order(order);
}
ou->free_ord(); delete ou;
delete fake_e;
// eval the form
Quad2D* quad = sln->get_quad_2d();
double3* pt = quad->get_points(order);
int np = quad->get_num_points(order);
// init geometry and jacobian*weights
Geom<double>* e = init_geom_vol(rm, order);
double* jac = rm->get_jacobian(order);
double* jwt = new double[np];
for(int i = 0; i < np; i++)
jwt[i] = pt[i][2] * jac[i];
// function values
Func<scalar>* u = init_fn(sln, order);
scalar res = form->value(np, jwt, NULL, u, u, e, NULL);
e->free(); delete e;
delete [] jwt;
u->free_fn(); delete u;
return std::abs(res);
}