本文整理汇总了C++中GaussPoint::giveMaterialMode方法的典型用法代码示例。如果您正苦于以下问题:C++ GaussPoint::giveMaterialMode方法的具体用法?C++ GaussPoint::giveMaterialMode怎么用?C++ GaussPoint::giveMaterialMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GaussPoint
的用法示例。
在下文中一共展示了GaussPoint::giveMaterialMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mtrx
//.........这里部分代码省略.........
}
#ifdef __VTK_MODULE
cellVarsArray->SetTuple3(ielem-1, mtrx.at(1, pos), mtrx.at(2,pos), mtrx.at(3,pos) );
#else
fprintf( stream, "%f %f %f ", mtrx.at(1, pos), mtrx.at(2, pos), mtrx.at(3, pos) );
#endif
}
#ifdef __VTK_MODULE
stream->GetCellData()->SetActiveVectors(__InternalStateTypeToString(type));
stream->GetCellData()->SetVectors(cellVarsArray);
#endif
break;
default:
bool reshape = false;
InternalStateValueType vt = giveInternalStateValueType(type);
if ( vt == ISVT_SCALAR ) {
ncomponents = 1;
} else if ( vt == ISVT_VECTOR ) {
ncomponents = 3;
} else {
ncomponents = 9;
reshape = true;
}
#ifdef __VTK_MODULE
cellVarsArray->SetNumberOfComponents(ncomponents);
cellVarsArray->SetNumberOfTuples(nelem);
#else
fprintf( stream, "<DataArray type=\"Float64\" Name=\"%s\" NumberOfComponents=\"%d\" format=\"ascii\">\n", __InternalStateTypeToString(type), ncomponents );
#endif
IntArray redIndx;
for ( ielem = 1; ielem <= nelem; ielem++ ) {
elem = d->giveElement(ielem);
if ( (( region > 0 ) && ( this->smoother->giveElementVirtualRegionNumber(ielem) != region ))
|| this->isElementComposite(elem) || !elem-> isActivated(tStep) ) { // composite cells exported individually
continue;
}
#ifdef __PARALLEL_MODE
if ( elem->giveParallelMode() != Element_local ) {
continue;
}
#endif
gptot = 0;
answer.resize(0);
iRule = elem->giveDefaultIntegrationRulePtr();
if (iRule) {
MaterialMode mmode = _Unknown;
for (int i = 0; i < iRule->getNumberOfIntegrationPoints(); ++i) {
gp = iRule->getIntegrationPoint(i);
mmode = gp->giveMaterialMode();
elem->giveIPValue(temp, gp, type, tStep);
gptot += gp->giveWeight();
answer.add(gp->giveWeight(), temp);
}
answer.times(1./gptot);
elem->giveMaterial()->giveIntVarCompFullIndx(redIndx, type, mmode);
}
// Reshape the Voigt vectors to include all components (duplicated if necessary, VTK insists on 9 components for tensors.)
if ( reshape && answer.giveSize() != 9) { // If it has 9 components, then it is assumed to be proper already.
FloatArray tmp = answer;
this->makeFullForm(answer, tmp, vt, redIndx);
} else if ( vt == ISVT_VECTOR && answer.giveSize() < 3) {
answer.setValues(3,
answer.giveSize() > 1 ? answer.at(1) : 0.0,
answer.giveSize() > 2 ? answer.at(2) : 0.0,
0.0);
} else if ( ncomponents != answer.giveSize() ) { // Trying to gracefully handle bad cases, just output zeros.
answer.resize(ncomponents);
answer.zero();
}
for (int i = 1; i <= ncomponents; ++i) {
#ifdef __VTK_MODULE
cellVarsArray->SetComponent(ielem-1, i-1, answer.at(i));
#else
fprintf( stream, "%e ", answer.at(i) );
#endif
}
#ifndef __VTK_MODULE
fprintf( stream, "\n" );
#endif
}
#ifdef __VTK_MODULE
if (ncomponents == 1) {
stream->GetCellData()->SetActiveScalars(__InternalStateTypeToString(type));
stream->GetCellData()->SetScalars(cellVarsArray);
} else if (ncomponents == 3) {
stream->GetCellData()->SetActiveVectors(__InternalStateTypeToString(type));
stream->GetCellData()->SetVectors(cellVarsArray);
} else {
stream->GetCellData()->SetActiveTensors(__InternalStateTypeToString(type));
stream->GetCellData()->SetTensors(cellVarsArray);
}
#endif
}
#ifndef __VTK_MODULE
fprintf(stream, "</DataArray>\n");
#endif
}