本文整理汇总了C++中Face::Area方法的典型用法代码示例。如果您正苦于以下问题:C++ Face::Area方法的具体用法?C++ Face::Area怎么用?C++ Face::Area使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Face
的用法示例。
在下文中一共展示了Face::Area方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
Automatizator aut;
Automatizator::MakeCurrent(&aut);
INMOST_DATA_ENUM_TYPE iphi = aut.RegisterTag(phi,CELL);
aut.EnumerateEntries();
// Set the indeces intervals for the matrix and vectors
R.SetInterval(aut.GetFirstIndex(),aut.GetLastIndex());
R.InitLocks();
Update.SetInterval(aut.GetFirstIndex(),aut.GetLastIndex());
dynamic_variable Phi(aut,iphi);
// Solve \nabla \cdot \nabla phi = f equation
//for( Mesh::iteratorFace face = m->BeginFace(); face != m->EndFace(); ++face )
#if defined(USE_OMP)
#pragma omp parallel
#endif
{
variable flux; //should be more efficient to define here to avoid multiple memory allocations if storage for variations should be expanded
rMatrix x1(3,1), x2(3,1), xf(3,1), n(3,1);
double d1, d2, k1, k2, area, T, a, b, c;
#if defined(USE_OMP)
#pragma omp for
#endif
for(Storage::integer iface = 0; iface < m->FaceLastLocalID(); ++iface ) if( m->isValidFace(iface) )
{
Face face = Face(m,ComposeFaceHandle(iface));
Element::Status s1,s2;
Cell r1 = face->BackCell();
Cell r2 = face->FrontCell();
if( ((!r1->isValid() || (s1 = r1->GetStatus()) == Element::Ghost)?0:1) +
((!r2->isValid() || (s2 = r2->GetStatus()) == Element::Ghost)?0:1) == 0) continue;
area = face->Area(); // Get the face area
face->UnitNormal(n.data()); // Get the face normal
face->Centroid(xf.data()); // Get the barycenter of the face
r1->Centroid(x1.data()); // Get the barycenter of the cell
k1 = n.DotProduct(rMatrix::FromTensor(tag_K[r1].data(),
tag_K[r1].size(),3)*n);
d1 = fabs(n.DotProduct(xf-x1));
if( !r2->isValid() ) // boundary condition
{
// bnd_pnt is a projection of the cell center to the face
// a*pb + bT(pb-p1) = c
// F = T(pb-p1)
// pb = (c + bTp1)/(a+bT)
// F = T/(a+bT)(c - ap1)
T = k1/d1;
a = 0;
b = 1;
c = 0;
if( tag_BC.isValid() && face.HaveData(tag_BC) )
{
a = tag_BC[face][0];
b = tag_BC[face][1];
c = tag_BC[face][2];
//std::cout << "a " << a << " b " << b << " c " << c << std::endl;
}
R.Lock(Phi.Index(r1));
R[Phi.Index(r1)] -= T/(a + b*T) * area * (c - a*Phi(r1));
R.UnLock(Phi.Index(r1));
}
else
{
r2->Centroid(x2.data());
k2 = n.DotProduct(rMatrix::FromTensor(tag_K[r2].data(),
示例2: if
//.........这里部分代码省略.........
gammaK(1,3), //transversal part of co-normal at cell K
gammaL(1,3), //transversal part of co-normal at cell L
iT(3,3), //heterogeneous interpolation tensor
iC(1,3) //heterogeneous interpolation correction
;
real A, //area of the face
U, //normal component of the velocity
C, //coefficient for upstream cell
T, //two-point transmissibility
R, //right hand side
dK, //distance from center to interface at cell K
dL, //distance from center to interface at cell L
lambdaK, //projection of co-normal onto normal at cell K
lambdaL //projection of co-normal onto normal at cell L
;
const real eps = degenerate_diffusion_regularization;
Cell cK, cL, cU;
Face fKL;
bulk flag_DIFF, flag_CONV;
KK.Zero();
KL.Zero();
KD.Zero();
U = 0.0;
#if defined(USE_OMP)
#pragma omp for
#endif
for(integer q = 0; q < m->FaceLastLocalID(); ++q ) if( m->isValidFace(q) )
{
fKL = m->FaceByLocalID(q);
if( !BuildFlux(fKL) ) continue;
fKL.Centroid(xKL.data());
fKL.UnitNormal(nKL.data());
A = fKL.Area();
if( tag_U.isValid() ) U = fKL.Real(tag_U);
cK = fKL.BackCell();
cL = fKL.FrontCell();
assert(cK.isValid());
cK.Centroid(xK.data());
dK = nKL.DotProduct(xKL-xK);
yK = xK + dK*nKL;
if( tag_K.isValid() )
KK = rMatrix::FromTensor(cK.RealArray(tag_K).data(),cK.RealArray(tag_K).size());//.Transpose();
KKn = nKL*KK;
lambdaK = nKL.DotProduct(KKn);
gammaK = KKn - lambdaK*nKL;
//Diffusion part
uK.Zero();
uL.Zero();
if( cL.isValid() ) //internal, both cells are present
{
cL.Centroid(xL.data());
dL = nKL.DotProduct(xL-xKL);
yL = xL - dL*nKL;
if( tag_K.isValid() )
KL = rMatrix::FromTensor(cL.RealArray(tag_K).data(),cL.RealArray(tag_K).size());//.Transpose();
KLn = nKL*KL;
lambdaL = nKL.DotProduct(KLn);
gammaL = KLn - lambdaL*nKL;
//don't forget the area!
R = 0;