void
RigidArmNode :: postInitialize()
{
    Node :: postInitialize();
    
    // allocate auxiliary arrays
    allocAuxArrays();
    
    this->masterNode = dynamic_cast< Node * >( this->domain->giveDofManager(masterDofMngr) );
    if ( !masterNode ) {
        OOFEM_WARNING("RigidArmNode :: postInitialize: master dofManager is not a node");
    }
    
    int masterNdofs = masterNode->giveNumberOfDofs();

    IntArray masterNodes(masterNdofs);
    for ( int i = 1; i <= masterNdofs; i++ ) {
        masterNodes.at(i) = this->masterNode->giveNumber();
    }

    for ( int i = 1; i <= numberOfDofs; i++ ) {
        if ( masterDofID [ i - 1 ] ) {
            countOfMasterDofs->at(i) = 0;
            masterDofID [ i - 1 ]->resize(masterNdofs);
            masterContribution [ i - 1 ]->resize(masterNdofs);
        }
    }

    this->computeMasterContribution();

    // initialize slave dofs (inside check of consistency of receiver and master dof)
    for ( int i = 1; i <= numberOfDofs; i++ ) {
        SlaveDof *sdof = dynamic_cast< SlaveDof* >( dofArray [ i - 1 ] );
        if ( sdof ) {
            sdof->initialize(countOfMasterDofs->at(i), masterNodes, masterDofID [ i - 1 ], *masterContribution [ i - 1 ]);
        }
    }

#if 0
#ifdef __PARALLEL_MODE
    // check if master in same mode
    if ( parallel_mode != DofManager_local ) {
        if ( ( * masterNode )->giveParallelMode() != parallel_mode ) {
        _warning2("checkConsistency: mismatch in parallel mode of RigidArmNode and master", 1);
        result = 0;
        }
    }
#endif
#endif

    // deallocate auxiliary arrays
    deallocAuxArrays();

}
Example #2
0
void
RigidArmNode :: postInitialize()
{
    Node :: postInitialize();

    // auxiliary arrays
    std::map< DofIDItem, IntArray > masterDofID;
    std::map< DofIDItem, FloatArray > masterContribution;

    this->masterNode = dynamic_cast< Node * >( this->domain->giveDofManager(masterDofMngr) );
    if ( !masterNode ) {
        OOFEM_WARNING("master dofManager is not a node");
    }

    int masterNdofs = masterNode->giveNumberOfDofs();

    IntArray masterNodes(masterNdofs);
    for ( int &nodeNum: masterNodes ) {
        nodeNum = this->masterNode->giveNumber();
    }

    this->computeMasterContribution(masterDofID, masterContribution);

    // initialize slave dofs (inside check of consistency of receiver and master dof)
    for ( Dof *dof: *this ) {
        SlaveDof *sdof = dynamic_cast< SlaveDof * >(dof);
        if ( sdof ) {
            DofIDItem id = sdof->giveDofID();
            sdof->initialize(masterNodes, masterDofID [ id ], masterContribution [ id ]);
        }
    }

#if 0
    // check if master in same mode
    if ( parallel_mode != DofManager_local ) {
        if ( ( * masterNode )->giveParallelMode() != parallel_mode ) {
            OOFEM_WARNING("mismatch in parallel mode of RigidArmNode and master", 1);
            result = 0;
        }
    }
#endif
}
Example #3
0
int
RigidArmNode :: checkConsistency()
// Checks internal data consistency in node.
// Current implementation checks (when receiver has slave dofs) if receiver has the same
// coordinate system as master dofManager of slave dof.
// If requested, computes natural coordinates on element-like masternodes

{
    int result = 1;
    int i, ndofs;
    Node *master;

    result = result && Node :: checkConsistency();

    // finds master node
    master = dynamic_cast< Node * >( this->domain->giveDofManager(masterDofMngr) );
    if ( !master ) {
        _warning2("checkConsistency: master dofManager is not compatible", 1);
        result = 0;
    }

    // check if receiver has the same coordinate system as master dofManager
    if ( !this->hasSameLCS(master) ) {
        _warning2("checkConsistency: different lcs for master/slave nodes", 1);
        result = 0;
    }

    // check if created DOFs (dofType) compatible with mastermask
    ndofs = master->giveNumberOfDofs();
    for ( i = 1; i <= numberOfDofs; i++ ) {
        if ( masterMask->at(i) && ( dofArray [ i - 1 ]->giveClassID() == MasterDofClass ) ) {
            _error("checkConsistency: incompatible mastermask and doftype data");
        }
    }


    // allocate
    for ( i = 1; i <= numberOfDofs; i++ ) {
        if ( masterDofID [ i - 1 ] ) {
            countOfMasterDofs->at(i) = 0;
            masterDofID [ i - 1 ]->resize(ndofs);
            masterContribution [ i - 1 ]->resize(ndofs);
        }
    }

    IntArray masterNodes(ndofs);
    masterNode = master;
    for ( i = 1; i <= ndofs; i++ ) {
        masterNodes.at(i) = master->giveNumber();
    }

    result = result && computeMasterContribution();

    // initialize slave dofs (inside check of consistency of receiver and master dof)
    for ( i = 1; i <= numberOfDofs; i++ ) {
        if ( dofArray [ i - 1 ]->giveClassID() == SlaveDofClass ) {
            ( ( SlaveDof * ) dofArray [ i - 1 ] )->initialize(countOfMasterDofs->at(i), masterNodes, masterDofID [ i - 1 ], *masterContribution [ i - 1 ]);
        }
    }

    /*
     * #ifdef __PARALLEL_MODE
     *  // check if master in same mode
     *  if ( parallel_mode != DofManager_local ) {
     *      if ( ( * masterNode )->giveParallelMode() != parallel_mode ) {
     *          _warning2("checkConsistency: mismatch in parallel mode of RigidArmNode and master", 1);
     *          result = 0;
     *      }
     *  }
     *
     * #endif
     */

    // deallocate auxiliary arrays
    deallocAuxArrays();

    return result;
}