本文整理汇总了C++中Mesh::AddVolumeElement方法的典型用法代码示例。如果您正苦于以下问题:C++ Mesh::AddVolumeElement方法的具体用法?C++ Mesh::AddVolumeElement怎么用?C++ Mesh::AddVolumeElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mesh
的用法示例。
在下文中一共展示了Mesh::AddVolumeElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Ng_AddVolumeElement
// Manually add a volume element of a given type to an existing mesh object
DLL_HEADER void Ng_AddVolumeElement (Ng_Mesh * mesh, Ng_Volume_Element_Type et,
int * pi)
{
Mesh * m = (Mesh*)mesh;
Element el (4);
el.SetIndex (1);
el.PNum(1) = pi[0];
el.PNum(2) = pi[1];
el.PNum(3) = pi[2];
el.PNum(4) = pi[3];
m->AddVolumeElement (el);
}
示例2: RefinePrisms
//.........这里部分代码省略.........
if (pi1 == pi2)
npi[j-1] = pi1;
else
{
INDEX_2 edge(pi1, pi2);
edge.Sort();
if (refedges.Used (edge))
npi[j-1] = refedges.Get(edge);
else
{
/*
(*testout) << "ERROR: prism " << i << " has hanging node !!"
<< ", edge = " << edge << endl;
cerr << "ERROR: prism " << i << " has hanging node !!" << endl;
*/
npi[j-1] = 0;
}
}
}
if (npi[0])
{
Element nel1(6), nel2(6);
for (j = 1; j <= 3; j++)
{
nel1.PNum(j) = el.PNum(j);
nel1.PNum(j+3) = npi[j-1];
nel2.PNum(j) = npi[j-1];
nel2.PNum(j+3) = el.PNum(j+3);
}
nel1.SetIndex (el.GetIndex());
nel2.SetIndex (el.GetIndex());
mesh.VolumeElement (i) = nel1;
mesh.AddVolumeElement (nel2);
}
}
PrintMessage (5, "Elements done, NE = ", mesh.GetNE());
// do surface elements
int oldnse = mesh.GetNSE();
// cout << "oldnse = " << oldnse << endl;
for (i = 1; i <= oldnse; i++)
{
Element2d & el = mesh.SurfaceElement (i);
if (el.GetType() != QUAD)
continue;
int index = el.GetIndex();
int npi[2];
for (j = 1; j <= 2; j++)
{
int pi1, pi2;
if (j == 1)
{
pi1 = el.PNum(1);
pi2 = el.PNum(4);
}
else
{
pi1 = el.PNum(2);
pi2 = el.PNum(3);
}
示例3: GenerateBoundaryLayer
//.........这里部分代码省略.........
mesh.LineSegment(i)[0] = mapto.Get(seg_p1);
mesh.LineSegment(i)[1] = mapto.Get(seg_p2);
mesh.LineSegment(j)[1] = mapto.Get(seg_p1);
mesh.LineSegment(j)[0] = mapto.Get(seg_p2);
}
}
}
}
}
// Add prismatic cells at the boundaries
cout << "Generating prism boundary layer volume elements...." << endl;
for (i = 1; i <= nse; i++)
{
Element2d & sel = mesh.SurfaceElement(i);
if(surfid.Contains(sel.GetIndex()))
{
Element el(PRISM);
for (j = 1; j <= sel.GetNP(); j++)
{
// Check (Doublecheck) if the corresponding point has a
// copy available for remapping
if (mapto.Get(sel.PNum(j)))
{
// Define the points of the newly added Prism cell
el.PNum(j+3) = mapto.Get(sel.PNum(j));
el.PNum(j) = sel.PNum(j);
}
}
el.SetIndex(1);
el.Invert();
mesh.AddVolumeElement(el);
numprisms++;
}
}
// Finally switch the point indices of the surface elements
// to the newly added ones
cout << "Transferring boundary layer surface elements to new vertex references...." << endl;
for (i = 1; i <= nse; i++)
{
Element2d & sel = mesh.SurfaceElement(i);
if(surfid.Contains(sel.GetIndex()))
{
for (j = 1; j <= sel.GetNP(); j++)
{
// Check (Doublecheck) if the corresponding point has a
// copy available for remapping
if (mapto.Get(sel.PNum(j)))
{
// Map the surface elements to the new points
sel.PNum(j) = mapto.Get(sel.PNum(j));
}
}
}
}
// Lock all the prism points so that the rest of the mesh can be
// optimised without invalidating the entire mesh
for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End(); pi++)
{
if(bndnodes.Test(i)) mesh.AddLockedPoint(pi);
}