本文整理汇总了C++中Triangle::H方法的典型用法代码示例。如果您正苦于以下问题:C++ Triangle::H方法的具体用法?C++ Triangle::H怎么用?C++ Triangle::H使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Triangle
的用法示例。
在下文中一共展示了Triangle::H方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: P
void TypeOfFE_P0::FB(const bool* whatd,const Mesh & ,const Triangle & K,const R2 & PHat,RNMK_ & val) const
{ //
// const Triangle & K(FE.T);
R2 P(K(PHat));
R2 A(K[0]), B(K[1]),C(K[2]);
//R l0=1-P.x-P.y,l1=P.x,l2=P.y;
R2 Dl0(K.H(0)), Dl1(K.H(1)), Dl2(K.H(2));
throwassert(val.N() >=1);
throwassert(val.M()==1 );
// throwassert(val.K()==3 );
val=0;
if ( whatd[op_id])
val(0,0,0) =1;
}
示例2: A
void TypeOfFE_P1ttdc::FB(const bool *whatd,const Mesh & ,const Triangle & K,const R2 & P1,RNMK_ & val) const
{
R2 P=Shrink1(P1);
// const Triangle & K(FE.T);
R2 A(K[0]), B(K[1]),C(K[2]);
R l0=1-P.x-P.y,l1=P.x,l2=P.y;
if (val.N() <3)
throwassert(val.N() >=3);
throwassert(val.M()==1 );
// throwassert(val.K()==3 );
val=0;
RN_ f0(val('.',0,op_id));
if (whatd[op_id])
{
f0[0] = l0;
f0[1] = l1;
f0[2] = l2;}
if (whatd[op_dx] || whatd[op_dy])
{
R2 Dl0(K.H(0)*cshrink1), Dl1(K.H(1)*cshrink1), Dl2(K.H(2)*cshrink1);
if (whatd[op_dx])
{
RN_ f0x(val('.',0,op_dx));
f0x[0] = Dl0.x;
f0x[1] = Dl1.x;
f0x[2] = Dl2.x;
}
if (whatd[op_dy]) {
RN_ f0y(val('.',0,op_dy));
f0y[0] = Dl0.y;
f0y[1] = Dl1.y;
f0y[2] = Dl2.y;
}
}
}
示例3: A
void TypeOfFE_P4dcLagrange::FB (const bool *whatd, const Mesh &, const Triangle &K, const R2 &P1, RNMK_ &val) const {
R2 P = Shrink1(P1);
R2 A(K[0]), B(K[1]), C(K[2]);
R l0 = 1. - P.x - P.y, l1 = P.x, l2 = P.y;
R L[3] = {l0 *k, l1 *k, l2 *k};
throwassert(val.N() >= 14);
throwassert(val.M() == 1);
// Attention il faut renumeroter les fonction de bases
// car dans freefem++, il y a un node par sommet, arete or element
// et la numerotation naturelle mais 2 noud pas arete
// donc p est la perumation
// echange de numerotation si les arete sont dans le mauvais sens
int p[15];
for (int i = 0; i < 15; ++i) {
p[i] = i;
}
// if(K.EdgeOrientation(0) <0) Exchange(p[3],p[5]);// 3,4
// if(K.EdgeOrientation(1) <0) Exchange(p[6],p[8]);// 5,6
// if(K.EdgeOrientation(2) <0) Exchange(p[9],p[11]);// 7,8
// cout << KN_<int>(p,10) <<endl;
val = 0;
/*
* // les fonction de base du Pk Lagrange sont
* //
* //
*/
// --
if (whatd[op_id]) {
RN_ f0(val('.', 0, op_id));
for (int df = 0; df < ndf; df++) {
int pdf = p[df];
R f = 1. / ff[df];
for (int i = 0; i < k; ++i) {
f *= L[nn[df][i]] - aa[df][i];
// cout << L[nn[df][i]]-aa[df][i]<< " ";
}
f0[pdf] = f;
// cout << pdf<< " " << df << " f " <<f <<endl;
}
// cout <<" L " << L[0] << " " << L[1] << " " << L[2] << endl;
// cout << ndf << " nbf = "<< f0 <<endl;
}
if (whatd[op_dx] || whatd[op_dy] || whatd[op_dxx] || whatd[op_dyy] || whatd[op_dxy]) {
R ks = k * cshrink1;
R2 D [] = {K.H(0) * ks, K.H(1) * ks, K.H(2) * ks};
if (whatd[op_dx] || whatd[op_dy]) {
for (int df = 0; df < ndf; df++) {
int pdf = p[df];
R fx = 0., fy = 0., f = 1. / ff[df];
for (int i = 0; i < k; ++i) {
int n = nn[df][i];
R Ln = L[n] - aa[df][i];
fx = fx * Ln + f * D[n].x;
fy = fy * Ln + f * D[n].y;
f = f * Ln;
}
if (whatd[op_dx]) {val(pdf, 0, op_dx) = fx;}
if (whatd[op_dy]) {val(pdf, 0, op_dy) = fy;}
}
}
if (whatd[op_dyy] || whatd[op_dxy] || whatd[op_dxx]) {
for (int df = 0; df < ndf; df++) {
int pdf = p[df];
R fx = 0., fy = 0., f = 1. / ff[df];
R fxx = 0., fyy = 0., fxy = 0.;
for (int i = 0; i < k; ++i) {
int n = nn[df][i];
R Ln = L[n] - aa[df][i];
fxx = fxx * Ln + 2. * fx * D[n].x;
fyy = fyy * Ln + 2. * fy * D[n].y;
fxy = fxy * Ln + fx * D[n].y + fy * D[n].x;
fx = fx * Ln + f * D[n].x;
fy = fy * Ln + f * D[n].y;
f = f * Ln;
}
if (whatd[op_dxx]) {val(pdf, 0, op_dxx) = fxx;}
if (whatd[op_dyy]) {val(pdf, 0, op_dyy) = fyy;}
if (whatd[op_dxy]) {val(pdf, 0, op_dxy) = fxy;}
}
}
}
}
示例4: FB
void TypeOfFE_RTmodif::FB(const bool * whatd,const Mesh & Th,const Triangle & K,const R2 & PHat,RNMK_ & val) const
{ //
// const Triangle & K(FE.T);
R2 P(K(PHat));
R2 A(K[0]), B(K[1]),C(K[2]);
R la=1-PHat.x-PHat.y,lb=PHat.x,lc=PHat.y;
R2 Dla(K.H(0)), Dlb(K.H(1)), Dlc(K.H(2));
if (val.N() <3)
throwassert(val.N() >=3);
throwassert(val.M()==2 );
R2 AB(A,B),AC(A,C),BA(B,A),BC(B,C),CA(C,A),CB(C,B);
R aa0= 1./(((AB,Dlb) + (AC,Dlc))*K.area);
R aa1= 1./(((BA,Dla) + (BC,Dlc))*K.area);
R aa2= 1./(((CA,Dla) + (CB,Dlb))*K.area);
int i=0;
R a0= &K[ (i+1)%3] < &K[ (i+2)%3] ? aa0 : -aa0 ;
i=1;
R a1= &K[ (i+1)%3] < &K[ (i+2)%3] ? aa1 : -aa1 ;
i=2;
R a2= &K[ (i+1)%3] < &K[ (i+2)%3] ? aa2 : -aa2 ;
// if (Th(K)< 2) cout << Th(K) << " " << A << " " << B << " " << C << "; " << a0 << " " << a1 << " "<< a2 << endl;;
R2 Va= AB*(lb*a0) + AC*(lc*a0);
R2 Vb= BA*(la*a1) + BC*(lc*a1);
R2 Vc= CA*(la*a2) + CB*(lb*a2);
R2 Va_x= AB*(Dlb.x*a0) + AC*(Dlc.x*a0);
R2 Vb_x= BA*(Dla.x*a1) + BC*(Dlc.x*a1);
R2 Vc_x= CA*(Dla.x*a2) + CB*(Dlb.x*a2);
R2 Va_y= AB*(Dlb.y*a0) + AC*(Dlc.y*a0);
R2 Vb_y= BA*(Dla.y*a1) + BC*(Dlc.y*a1);
R2 Vc_y= CA*(Dla.y*a2) + CB*(Dlb.y*a2);
if( whatd[op_id])
{
RN_ f0(val('.',0,0));
RN_ f1(val('.',1,0));
f0[0] = Va.x;
f1[0] = Va.y;
f0[1] = Vb.x;
f1[1] = Vb.y;
f0[2] = Vc.x;
f1[2] = Vc.y;
}
// ----------------
if( whatd[op_dx])
{
val(0,0,1) = Va_x.x;
val(0,1,1) = Va_x.y;
val(1,0,1) = Vb_x.x;
val(1,1,1) = Vb_x.y;
val(2,0,1) = Vc_x.x;
val(2,1,1) = Vc_x.y;
}
if( whatd[op_dy])
{
val(0,0,2) = Va_y.x;
val(0,1,2) = Va_y.y;
val(1,0,2) = Vb_y.x;
val(1,1,2) = Vb_y.y;
val(2,0,2) = Vc_y.x;
val(2,1,2) = Vc_y.y;
}
}