本文整理汇总了C++中GaussPoint::giveElement方法的典型用法代码示例。如果您正苦于以下问题:C++ GaussPoint::giveElement方法的具体用法?C++ GaussPoint::giveElement怎么用?C++ GaussPoint::giveElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GaussPoint
的用法示例。
在下文中一共展示了GaussPoint::giveElement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
int
MMALeastSquareProjection :: __mapVariable(FloatArray &answer, FloatArray &targetCoords,
InternalStateType type, TimeStep *tStep)
{
//int nelem, ielem,
int neq = this->giveNumberOfUnknownPolynomialCoefficients(this->patchType);
int nval = 0;
FloatArray ipVal, coords, P;
FloatMatrix a, rhs, x;
Element *element;
//IntegrationRule* iRule;
a.resize(neq, neq);
a.zero();
// determine the value from patch
int size = patchGPList.size();
if ( size == 1 ) {
GaussPoint *srcgp = *patchGPList.begin();
srcgp->giveElement()->giveIPValue(answer, srcgp, type, tStep);
} else if ( size < neq ) {
OOFEM_ERROR("internal error");
} else {
for ( auto &srcgp: patchGPList ) {
element = srcgp->giveElement();
element->giveIPValue(ipVal, srcgp, type, tStep);
if ( nval == 0 ) {
nval = ipVal.giveSize();
rhs.resize(neq, nval);
rhs.zero();
}
if ( element->computeGlobalCoordinates( coords, srcgp->giveNaturalCoordinates() ) ) {
coords.subtract(targetCoords);
// compute ip contribution
this->computePolynomialTerms(P, coords, patchType);
for ( int j = 1; j <= neq; j++ ) {
for ( int k = 1; k <= nval; k++ ) {
rhs.at(j, k) += P.at(j) * ipVal.at(k);
}
for ( int k = 1; k <= neq; k++ ) {
a.at(j, k) += P.at(j) * P.at(k);
}
}
} else {
OOFEM_ERROR("computeGlobalCoordinates failed");
}
}
#if 0
// check for correct solution
FloatMatrix aa = a;
#endif
a.solveForRhs(rhs, x);
#if 0
// check for correct solution
FloatMatrix tmp;
tmp.beProductOf(aa, x);
for ( j = 1; j <= neq; j++ ) {
for ( k = 1; k <= nval; k++ ) {
if ( fabs( tmp.at(j, k) - rhs.at(j, k) ) > 1.e-3 ) {
printf("(SE)");
}
}
}
#endif
// determine the value from patch
targetCoords.zero();
//gp->giveElement()->computeGlobalCoordinates (coords, gp->giveNaturalCoordinates());
this->computePolynomialTerms(P, targetCoords, patchType);
answer.resize(nval);
answer.zero();
for ( int i = 1; i <= nval; i++ ) {
for ( int j = 1; j <= neq; j++ ) {
answer.at(i) += P.at(j) * x.at(j, i);
}
}
}
/*
* double ee;
* aa.subtract (answer);
* ee = sqrt(dotProduct(aa,aa,aa.giveSize()));
* if ((aa.giveSize() != answer.giveSize()) || (ee > 1.e-6)) {
* printf("Diference @@@@@!\n");
* exit (1);
* }
*/
return 1;
}