void FreeWarping :: computeResultAtCenterOfGravity(TimeStep *tStep) { int noCS = this->giveDomain(1)->giveNumberOfCrossSectionModels(); //number of warping Crosssections SolutionAtCG.resize(noCS); Element *closestElement; FloatArray lcoords, closest, lcg; SpatialLocalizer *sp = this->giveDomain(1)->giveSpatialLocalizer(); sp->init(); lcoords.resize(2); closest.resize(2); lcg.resize(2); for ( int j = 1; j <= noCS; ++j ) { lcg.at(1) = CG.at(j, 1); lcg.at(2) = CG.at(j, 2); closestElement = sp->giveElementClosestToPoint(lcoords, closest, lcg, 0); StructuralElement *sE = dynamic_cast< StructuralElement * >(closestElement); FloatArray u, r, b; FloatMatrix N; sE->computeNmatrixAt(lcoords, N); sE->computeVectorOf(VM_Total, tStep, u); u.resizeWithValues(3); r.beProductOf(N, u); SolutionAtCG.at(j) = r.at(1); } }
void GradDpElement :: computeNonlocalDegreesOfFreedom(FloatArray &answer, TimeStep *tStep) { ///@todo Just use this instead! (should work, but I don't have any tests right now) #if 0 this->giveStructuralElement()->computeVectorOf({G_0}, VM_Total, tStep, answer); #else StructuralElement *elem = this->giveStructuralElement(); FloatArray u; answer.resize(nlSize); elem->computeVectorOf(VM_Total, tStep, u); u.resizeWithValues(totalSize); for ( int i = 1; i <= nlSize; i++ ) { answer.at(i) = u.at( locK.at(i) ); } #endif }