void RigidArmNode :: computeMasterContribution(std::map< DofIDItem, IntArray > &masterDofID, std::map< DofIDItem, FloatArray > &masterContribution) { #if 0 // original implementation without support of different LCS in slave and master int k; IntArray R_uvw(3), uvw(3); FloatArray xyz(3); int numberOfMasterDofs = masterNode->giveNumberOfDofs(); //IntArray countOfMasterDofs((int)masterDofID.size()); // decode of masterMask uvw.at(1) = this->dofidmask->findFirstIndexOf(R_u); uvw.at(2) = this->dofidmask->findFirstIndexOf(R_v); uvw.at(3) = this->dofidmask->findFirstIndexOf(R_w); xyz.beDifferenceOf(*this->giveCoordinates(), *masterNode->giveCoordinates()); if ( hasLocalCS() ) { // LCS is stored as global-to-local, so LCS*xyz_glob = xyz_loc xyz.rotatedWith(* this->localCoordinateSystem, 'n'); } for ( int i = 1; i <= this->dofidmask->giveSize(); i++ ) { Dof *dof = this->giveDofWithID(dofidmask->at(i)); DofIDItem id = dof->giveDofID(); masterDofID [ id ].resize(numberOfMasterDofs); masterContribution [ id ].resize(numberOfMasterDofs); R_uvw.zero(); switch ( masterMask.at(i) ) { case 0: continue; break; case 1: if ( id == D_u ) { if ( uvw.at(2) && masterMask.at( uvw.at(2) ) ) { R_uvw.at(3) = ( ( int ) R_v ); } if ( uvw.at(3) && masterMask.at( uvw.at(3) ) ) { R_uvw.at(2) = -( ( int ) R_w ); } } else if ( id == D_v ) { if ( uvw.at(1) && masterMask.at( uvw.at(1) ) ) { R_uvw.at(3) = -( ( int ) R_u ); } if ( uvw.at(3) && masterMask.at( uvw.at(3) ) ) { R_uvw.at(1) = ( ( int ) R_w ); } } else if ( id == D_w ) { if ( uvw.at(1) && masterMask.at( uvw.at(1) ) ) { R_uvw.at(2) = ( ( int ) R_u ); } if ( uvw.at(2) && masterMask.at( uvw.at(2) ) ) { R_uvw.at(1) = -( ( int ) R_v ); } } break; default: OOFEM_ERROR("unknown value in masterMask"); } //k = ++countOfMasterDofs.at(i); k = 1; masterDofID [ id ].at(k) = ( int ) id; masterContribution [ id ].at(k) = 1.0; for ( int j = 1; j <= 3; j++ ) { if ( R_uvw.at(j) != 0 ) { int sign = R_uvw.at(j) < 0 ? -1 : 1; //k = ++countOfMasterDofs.at(i); k++; masterDofID [ id ].at(k) = sign * R_uvw.at(j); masterContribution [ id ].at(k) = sign * xyz.at(j); } } masterDofID [ id ].resizeWithValues(k); masterContribution [ id ].resizeWithValues(k); } #else // receiver lcs stored in localCoordinateSystem // (this defines the transformation from global to local) FloatArray xyz(3); FloatMatrix TG2L(6,6); // receiver global to receiver local FloatMatrix TR(6,6); // rigid arm transformation between receiver global DOFs and Master global DOFs FloatMatrix TMG2L(6,6); // master global to local FloatMatrix T(6,6); // full transformation for all dofs IntArray fullDofMask = {D_u, D_v, D_w, R_u, R_v, R_w}; bool hasg2l = this->computeL2GTransformation(TG2L, fullDofMask); bool mhasg2l = masterNode->computeL2GTransformation(TMG2L, fullDofMask); xyz.beDifferenceOf(*this->giveCoordinates(), *masterNode->giveCoordinates()); TR.beUnitMatrix(); TR.at(1,5) = xyz.at(3); TR.at(1,6) = -xyz.at(2); TR.at(2,4) = -xyz.at(3); TR.at(2,6) = xyz.at(1); TR.at(3,4) = xyz.at(2); TR.at(3,5) = -xyz.at(1); if (hasg2l && mhasg2l) { FloatMatrix h; h.beTProductOf(TG2L, TR); // T transforms global master DOfs to local dofs; T.beProductOf(h,TMG2L); // Add transformation to master local c.s. } else if (hasg2l) { T.beTProductOf(TG2L, TR); // T transforms global master DOfs to local dofs; } else if (mhasg2l) { T.beProductOf(TR,TMG2L); // Add transformation to master local c.s. } else { T = TR; } // assemble DOF weights for relevant dofs for ( int i = 1; i <= this->dofidmask->giveSize(); i++ ) { Dof *dof = this->giveDofWithID(dofidmask->at(i)); DofIDItem id = dof->giveDofID(); masterDofID [ id ] = *dofidmask; masterContribution [ id ].resize(dofidmask->giveSize()); for (int j = 1; j <= this->dofidmask->giveSize(); j++ ) { masterContribution [ id ].at(j) = T.at(id, dofidmask->at(j)); } } #endif }
void RigidArmNode :: computeMasterContribution() { int k, sign; IntArray R_uvw(3), uvw(3); FloatArray xyz(3); DofIDItem id; // decode of masterMask uvw.at(1) = this->findDofWithDofId(R_u); uvw.at(2) = this->findDofWithDofId(R_v); uvw.at(3) = this->findDofWithDofId(R_w); for ( int i = 1; i <= 3; i++ ) { xyz.at(i) = this->giveCoordinate(i) - masterNode->giveCoordinate(i); } if ( hasLocalCS() ) { // LCS is stored as global-to-local, so LCS*xyz_glob = xyz_loc xyz.rotatedWith(* this->localCoordinateSystem, 'n'); } for ( int i = 1; i <= numberOfDofs; i++ ) { id = this->giveDof(i)->giveDofID(); R_uvw.zero(); switch ( masterMask.at(i) ) { case 0: continue; break; case 1: if ( id == D_u ) { if ( uvw.at(2) && masterMask.at( uvw.at(2) ) ) { R_uvw.at(3) = ( ( int ) R_v ); } if ( uvw.at(3) && masterMask.at( uvw.at(3) ) ) { R_uvw.at(2) = -( ( int ) R_w ); } } else if ( id == D_v ) { if ( uvw.at(1) && masterMask.at( uvw.at(1) ) ) { R_uvw.at(3) = -( ( int ) R_u ); } if ( uvw.at(3) && masterMask.at( uvw.at(3) ) ) { R_uvw.at(1) = ( ( int ) R_w ); } } else if ( id == D_w ) { if ( uvw.at(1) && masterMask.at( uvw.at(1) ) ) { R_uvw.at(2) = ( ( int ) R_u ); } if ( uvw.at(2) && masterMask.at( uvw.at(2) ) ) { R_uvw.at(1) = -( ( int ) R_v ); } } break; default: _error("computeMasterContribution: unknown value in masterMask"); } k = ++ this->countOfMasterDofs->at(i); this->masterDofID [ i - 1 ]->at(k) = ( int ) id; this->masterContribution [ i - 1 ]->at(k) = 1.0; for ( int j = 1; j <= 3; j++ ) { if ( R_uvw.at(j) != 0 ) { sign = R_uvw.at(j) < 0 ? -1 : 1; k = ++ this->countOfMasterDofs->at(i); this->masterDofID [ i - 1 ]->at(k) = sign * R_uvw.at(j); this->masterContribution [ i - 1 ]->at(k) = sign * xyz.at(j); } } } }