本文整理汇总了C++中Quad2D::get_edge_points方法的典型用法代码示例。如果您正苦于以下问题:C++ Quad2D::get_edge_points方法的具体用法?C++ Quad2D::get_edge_points怎么用?C++ Quad2D::get_edge_points使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quad2D
的用法示例。
在下文中一共展示了Quad2D::get_edge_points方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: integrate_over_wall
// Custom function to calculate drag coefficient.
double integrate_over_wall(MeshFunction* meshfn, int marker)
{
Quad2D* quad = &g_quad_2d_std;
meshfn->set_quad_2d(quad);
double integral = 0.0;
Element* e;
Mesh* mesh = meshfn->get_mesh();
for_all_active_elements(e, mesh)
{
for(int edge = 0; edge < e->nvert; edge++)
{
if ((e->en[edge]->bnd) && (e->en[edge]->marker == marker))
{
update_limit_table(e->get_mode());
RefMap* ru = meshfn->get_refmap();
meshfn->set_active_element(e);
int eo = quad->get_edge_points(edge);
meshfn->set_quad_order(eo, H2D_FN_VAL);
scalar *uval = meshfn->get_fn_values();
double3* pt = quad->get_points(eo);
double3* tan = ru->get_tangent(edge);
for (int i = 0; i < quad->get_num_points(eo); i++)
integral += pt[i][2] * uval[i] * tan[i][2];
}
}
}
return integral * 0.5;
}
示例2: eval_form
// Actual evaluation of surface linear form (calculates integral)
scalar FeProblem::eval_form(WeakForm::VectorFormSurf *vfs, Tuple<Solution *> u_ext, PrecalcShapeset *fv, RefMap *rv, EdgePos* ep)
{
// eval the form
Quad2D* quad = fv->get_quad_2d();
int eo = quad->get_edge_points(ep->edge);
double3* pt = quad->get_points(eo);
int np = quad->get_num_points(eo);
// init geometry and jacobian*weights
if (cache_e[eo] == NULL)
{
cache_e[eo] = init_geom_surf(rv, ep, eo);
double3* tan = rv->get_tangent(ep->edge);
cache_jwt[eo] = new double[np];
for(int i = 0; i < np; i++)
cache_jwt[eo][i] = pt[i][2] * tan[i][2];
}
Geom<double>* e = cache_e[eo];
double* jwt = cache_jwt[eo];
// 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, eo);
Func<double>* v = get_fn(fv, rv, eo);
ExtData<scalar>* ext = init_ext_fns(vfs->ext, rv, eo);
scalar res = vfs->fn(np, jwt, prev, v, e, ext);
for (int i = 0; i < wf->neq; i++) { prev[i]->free_fn(); delete prev[i]; }
ext->free(); delete ext;
return 0.5 * res;
}
示例3: CalculateBoundaryLength
//------------------------------------------------------------------------------
// Compute marked boundary length
//
double CalculateBoundaryLength(Mesh* mesh, int bdryMarker)
{
// Variables declaration.
Element* e;
double length = 0;
RefMap rm;
rm.set_quad_2d(&g_quad_2d_std);
Quad2D * quad = rm.get_quad_2d();
int points_location;
double3* points;
int np;
double3* tangents;
// Loop through all boundary faces of all active elements.
for_all_active_elements(e, mesh) {
for(int edge = 0; edge < e->nvert; ++edge) {
if ((e->en[edge]->bnd) && (e->en[edge]->marker == bdryMarker)) {
rm.set_active_element(e);
points_location = quad->get_edge_points(edge);
points = quad->get_points(points_location);
np = quad->get_num_points(points_location);
tangents = rm.get_tangent(edge, points_location);
for(int i = 0; i < np; i++) {
// Weights sum up to two on every edge, therefore the division by two must be present.
length += 0.5 * points[i][2] * tangents[i][2];
}
}
}
}
return length;
} // end of CalculateBoundaryLength()
示例4: eval_boundary_estimator
double KellyTypeAdapt::eval_boundary_estimator(KellyTypeAdapt::ErrorEstimatorForm* err_est_form, RefMap *rm, SurfPos* surf_pos)
{
// determine the integration order
int inc = (this->sln[err_est_form->i]->get_num_components() == 2) ? 1 : 0;
Func<Ord>** oi = new Func<Ord>* [num];
for (int i = 0; i < num; i++)
oi[i] = init_fn_ord(this->sln[i]->get_edge_fn_order(surf_pos->surf_num) + inc);
// Order of additional external functions.
ExtData<Ord>* fake_ext = dp.init_ext_fns_ord(err_est_form->ext, surf_pos->surf_num);
double fake_wt = 1.0;
Geom<Ord>* fake_e = init_geom_ord();
Ord o = err_est_form->ord(1, &fake_wt, oi, oi[err_est_form->i], fake_e, fake_ext);
int order = rm->get_inv_ref_order();
order += o.get_order();
limit_order(order);
// Clean up.
for (int i = 0; i < this->num; i++)
if (oi[i] != NULL) { oi[i]->free_ord(); delete oi[i]; }
delete [] oi;
delete fake_e;
delete fake_ext;
// eval the form
Quad2D* quad = this->sln[err_est_form->i]->get_quad_2d();
int eo = quad->get_edge_points(surf_pos->surf_num, order);
double3* pt = quad->get_points(eo);
int np = quad->get_num_points(eo);
// init geometry and jacobian*weights
Geom<double>* e = init_geom_surf(rm, surf_pos, eo);
double3* tan = rm->get_tangent(surf_pos->surf_num, eo);
double* jwt = new double[np];
for(int i = 0; i < np; i++)
jwt[i] = pt[i][2] * tan[i][2];
// function values
Func<scalar>** ui = new Func<scalar>* [num];
for (int i = 0; i < num; i++)
ui[i] = init_fn(this->sln[i], eo);
ExtData<scalar>* ext = dp.init_ext_fns(err_est_form->ext, rm, eo);
scalar res = boundary_scaling_const *
err_est_form->value(np, jwt, ui, ui[err_est_form->i], e, ext);
for (int i = 0; i < this->num; i++)
if (ui[i] != NULL) { ui[i]->free_fn(); delete ui[i]; }
delete [] ui;
if (ext != NULL) { ext->free(); delete ext; }
e->free(); delete e;
delete [] jwt;
return std::abs(0.5*res); // Edges are parameterized from 0 to 1 while integration weights
// are defined in (-1, 1). Thus multiplying with 0.5 to correct
// the weights.
}
示例5: eval_interface_estimator
double KellyTypeAdapt::eval_interface_estimator(KellyTypeAdapt::ErrorEstimatorForm* err_est_form,
RefMap *rm, SurfPos* surf_pos,
LightArray<NeighborSearch*>& neighbor_searches, int neighbor_index)
{
NeighborSearch* nbs = neighbor_searches.get(neighbor_index);
Hermes::vector<MeshFunction*> slns;
for (int i = 0; i < num; i++)
slns.push_back(this->sln[i]);
// Determine integration order.
ExtData<Ord>* fake_ui = dp.init_ext_fns_ord(slns, neighbor_searches);
// Order of additional external functions.
// ExtData<Ord>* fake_ext = dp.init_ext_fns_ord(err_est_form->ext, nbs);
// Order of geometric attributes (eg. for multiplication of a solution with coordinates, normals, etc.).
Geom<Ord>* fake_e = new InterfaceGeom<Ord>(init_geom_ord(), nbs->neighb_el->marker, nbs->neighb_el->id, nbs->neighb_el->get_diameter());
double fake_wt = 1.0;
Ord o = err_est_form->ord(1, &fake_wt, fake_ui->fn, fake_ui->fn[err_est_form->i], fake_e, NULL);
int order = rm->get_inv_ref_order();
order += o.get_order();
limit_order(order);
// Clean up.
if (fake_ui != NULL)
{
for (int i = 0; i < num; i++)
delete fake_ui->fn[i];
fake_ui->free_ord();
delete fake_ui;
}
delete fake_e;
//delete fake_ext;
Quad2D* quad = this->sln[err_est_form->i]->get_quad_2d();
int eo = quad->get_edge_points(surf_pos->surf_num, order);
int np = quad->get_num_points(eo);
double3* pt = quad->get_points(eo);
// Init geometry and jacobian*weights (do not use the NeighborSearch caching mechanism).
double3* tan = rm->get_tangent(surf_pos->surf_num, eo);
double* jwt = new double[np];
for(int i = 0; i < np; i++)
jwt[i] = pt[i][2] * tan[i][2];
Geom<double>* e = new InterfaceGeom<double>(init_geom_surf(rm, surf_pos, eo),
nbs->neighb_el->marker,
nbs->neighb_el->id,
nbs->neighb_el->get_diameter());
// function values
ExtData<scalar>* ui = dp.init_ext_fns(slns, neighbor_searches, order);
//ExtData<scalar>* ext = dp.init_ext_fns(err_est_form->ext, nbs);
scalar res = interface_scaling_const *
err_est_form->value(np, jwt, ui->fn, ui->fn[err_est_form->i], e, NULL);
if (ui != NULL) { ui->free(); delete ui; }
//if (ext != NULL) { ext->free(); delete ext; }
e->free(); delete e;
delete [] jwt;
return std::abs(0.5*res); // Edges are parameterized from 0 to 1 while integration weights
// are defined in (-1, 1). Thus multiplying with 0.5 to correct
// the weights.
}