本文整理汇总了C++中StructuralElement::computeGlobalCoordinates方法的典型用法代码示例。如果您正苦于以下问题:C++ StructuralElement::computeGlobalCoordinates方法的具体用法?C++ StructuralElement::computeGlobalCoordinates怎么用?C++ StructuralElement::computeGlobalCoordinates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StructuralElement
的用法示例。
在下文中一共展示了StructuralElement::computeGlobalCoordinates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: du
void LSPrimaryVariableMapper :: mapPrimaryVariables(FloatArray &oU, Domain &iOldDom, Domain &iNewDom, ValueModeType iMode, TimeStep &iTStep)
{
EngngModel *engngMod = iNewDom.giveEngngModel();
EModelDefaultEquationNumbering num;
const int dim = iNewDom.giveNumberOfSpatialDimensions();
int numElNew = iNewDom.giveNumberOfElements();
// Count dofs
int numDofsNew = engngMod->giveNumberOfDomainEquations( 1, num );
oU.resize(numDofsNew);
oU.zero();
FloatArray du(numDofsNew);
du.zero();
FloatArray res(numDofsNew);
std :: unique_ptr< SparseMtrx > K;
std :: unique_ptr< SparseLinearSystemNM > solver;
solver.reset( classFactory.createSparseLinSolver(ST_Petsc, & iOldDom, engngMod) );
if (!solver) {
solver.reset( classFactory.createSparseLinSolver(ST_Direct, & iOldDom, engngMod) );
}
K.reset( classFactory.createSparseMtrx(solver->giveRecommendedMatrix(true)) );
K->buildInternalStructure( engngMod, iNewDom.giveNumber(), num );
int maxIter = 1;
for ( int iter = 0; iter < maxIter; iter++ ) {
K->zero();
res.zero();
// Contribution from elements
for ( int elIndex = 1; elIndex <= numElNew; elIndex++ ) {
StructuralElement *elNew = dynamic_cast< StructuralElement * >( iNewDom.giveElement(elIndex) );
if ( elNew == NULL ) {
OOFEM_ERROR("Failed to cast Element new to StructuralElement.");
}
///////////////////////////////////
// Compute residual
// Count element dofs
int numElNodes = elNew->giveNumberOfDofManagers();
int numElDofs = 0;
for ( int i = 1; i <= numElNodes; i++ ) {
numElDofs += elNew->giveDofManager(i)->giveNumberOfDofs();
}
FloatArray elRes(numElDofs);
elRes.zero();
IntArray elDofsGlob;
elNew->giveLocationArray( elDofsGlob, num );
// Loop over Gauss points
for ( int intRuleInd = 0; intRuleInd < elNew->giveNumberOfIntegrationRules(); intRuleInd++ ) {
for ( GaussPoint *gp: *elNew->giveIntegrationRule(intRuleInd) ) {
// New N-matrix
FloatMatrix NNew;
elNew->computeNmatrixAt(gp->giveNaturalCoordinates(), NNew);
//////////////
// Global coordinates of GP
const FloatArray &localCoord = gp->giveNaturalCoordinates();
FloatArray globalCoord;
elNew->computeGlobalCoordinates(globalCoord, localCoord);
//////////////
// Localize element and point in the old domain
FloatArray localCoordOld(dim), pointCoordOld(dim);
StructuralElement *elOld = dynamic_cast< StructuralElement * >( iOldDom.giveSpatialLocalizer()->giveElementClosestToPoint(localCoordOld, pointCoordOld, globalCoord, 0) );
if ( elOld == NULL ) {
OOFEM_ERROR("Failed to cast Element old to StructuralElement.");
}
// Compute N-Matrix for the old element
FloatMatrix NOld;
elOld->computeNmatrixAt(localCoordOld, NOld);
// Fetch nodal displacements for the new element
FloatArray nodeDispNew( elDofsGlob.giveSize() );
int dofsPassed = 1;
for ( int elNode: elNew->giveDofManArray() ) {
//.........这里部分代码省略.........