本文整理汇总了C++中Facet::dim方法的典型用法代码示例。如果您正苦于以下问题:C++ Facet::dim方法的具体用法?C++ Facet::dim怎么用?C++ Facet::dim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facet
的用法示例。
在下文中一共展示了Facet::dim方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_facet
//-----------------------------------------------------------------------------
bool DirichletBC::on_facet(const double* coordinates, const Facet& facet) const
{
// Check if the coordinates are on the same line as the line segment
if (facet.dim() == 1)
{
// Create points
Point p(coordinates[0], coordinates[1]);
const Point v0 = Vertex(facet.mesh(), facet.entities(0)[0]).point();
const Point v1 = Vertex(facet.mesh(), facet.entities(0)[1]).point();
// Create vectors
const Point v01 = v1 - v0;
const Point vp0 = v0 - p;
const Point vp1 = v1 - p;
// Check if the length of the sum of the two line segments vp0 and
// vp1 is equal to the total length of the facet
if ( std::abs(v01.norm() - vp0.norm() - vp1.norm()) < DOLFIN_EPS )
return true;
else
return false;
}
// Check if the coordinates are in the same plane as the triangular
// facet
else if (facet.dim() == 2)
{
// Create points
const Point p(coordinates[0], coordinates[1], coordinates[2]);
const Point v0 = Vertex(facet.mesh(), facet.entities(0)[0]).point();
const Point v1 = Vertex(facet.mesh(), facet.entities(0)[1]).point();
const Point v2 = Vertex(facet.mesh(), facet.entities(0)[2]).point();
// Create vectors
const Point v01 = v1 - v0;
const Point v02 = v2 - v0;
const Point vp0 = v0 - p;
const Point vp1 = v1 - p;
const Point vp2 = v2 - p;
// Check if the sum of the area of the sub triangles is equal to
// the total area of the facet
if (std::abs(v01.cross(v02).norm() - vp0.cross(vp1).norm()
- vp1.cross(vp2).norm() - vp2.cross(vp0).norm()) < DOLFIN_EPS)
{
return true;
}
else
return false;
}
dolfin_error("DirichletBC.cpp",
"determine if given point is on facet",
"Not implemented for given facet dimension");
return false;
}
示例2: onFacet
//-----------------------------------------------------------------------------
bool NewDirichletBC::onFacet(real* coordinates, Facet& facet)
{
// Check if the coordinates are on the same line as the line segment
if ( facet.dim() == 1 )
{
// Create points
Point p(coordinates[0], coordinates[1]);
Point v0 = Vertex(facet.mesh(), facet.entities(0)[0]).point();
Point v1 = Vertex(facet.mesh(), facet.entities(0)[1]).point();
// Create vectors
Point v01 = v1 - v0;
Point vp0 = v0 - p;
Point vp1 = v1 - p;
// Check if the length of the sum of the two line segments vp0 and vp1 is
// equal to the total length of the facet
if ( std::abs(v01.norm() - vp0.norm() - vp1.norm()) < DOLFIN_EPS )
return true;
else
return false;
}
// Check if the coordinates are in the same plane as the triangular facet
else if ( facet.dim() == 2 )
{
// Create points
Point p(coordinates[0], coordinates[1], coordinates[2]);
Point v0 = Vertex(facet.mesh(), facet.entities(0)[0]).point();
Point v1 = Vertex(facet.mesh(), facet.entities(0)[1]).point();
Point v2 = Vertex(facet.mesh(), facet.entities(0)[2]).point();
// Create vectors
Point v01 = v1 - v0;
Point v02 = v2 - v0;
Point vp0 = v0 - p;
Point vp1 = v1 - p;
Point vp2 = v2 - p;
// Check if the sum of the area of the sub triangles is equal to the total
// area of the facet
if ( std::abs(v01.cross(v02).norm() - vp0.cross(vp1).norm() - vp1.cross(vp2).norm()
- vp2.cross(vp0).norm()) < DOLFIN_EPS )
return true;
else
return false;
}
error("Unable to determine if given point is on facet (not implemented for given facet dimension).");
return false;
}
示例3: computeBCTopological
//-----------------------------------------------------------------------------
void NewDirichletBC::computeBCTopological(std::map<uint, real>& boundary_values,
Facet& facet,
BoundaryCondition::LocalData& data)
{
// Get cell to which facet belongs (there may be two, but pick first)
Cell cell(_mesh, facet.entities(facet.dim() + 1)[0]);
UFCCell ufc_cell(cell);
// Get local index of facet with respect to the cell
const uint local_facet = cell.index(facet);
// Interpolate function on cell
g.interpolate(data.w, ufc_cell, *data.finite_element, cell, local_facet);
// Tabulate dofs on cell
data.dof_map->tabulate_dofs(data.cell_dofs, ufc_cell);
// Tabulate which dofs are on the facet
data.dof_map->tabulate_facet_dofs(data.facet_dofs, local_facet);
// Pick values for facet
for (uint i = 0; i < data.dof_map->num_facet_dofs(); i++)
{
const uint dof = data.offset + data.cell_dofs[data.facet_dofs[i]];
const real value = data.w[data.facet_dofs[i]];
boundary_values[dof] = value;
}
}