Пример #1
0
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();

}
Пример #2
0
void SlaveNode :: postInitialize()
{
    Node :: postInitialize();

    // initialize slave dofs (inside check of consistency of receiver and master dof)
    for ( Dof *dof: *this ) {
        SlaveDof *sdof = dynamic_cast< SlaveDof * >(dof);
        if ( sdof ) {
            sdof->initialize(masterDofManagers, IntArray(), masterWeights);
        }
    }
}
Пример #3
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
}
Пример #4
0
void HangingNode :: postInitialize()
{
    Node :: postInitialize();

    Element *e;
    FEInterpolation *fei;
    FloatArray lcoords, masterContribution;

#ifdef __OOFEG
    if ( initialized ) {
        return;
    }
    initialized = true;
#endif

    // First check element and interpolation
    if ( masterElement == -1 ) { // Then we find it by taking the closest (probably containing element)
        FloatArray closest;
        SpatialLocalizer *sp = this->domain->giveSpatialLocalizer();
        sp->init();
        // Closest point or containing point? It should be contained, but with numerical errors it might be slightly outside
        // so the closest point is more robust.
        if ( !( e = sp->giveElementClosestToPoint(lcoords, closest, coordinates, this->masterRegion) ) ) {
            OOFEM_ERROR("Couldn't find closest element (automatically).");
        }
        this->masterElement = e->giveNumber();
    } else if ( !( e = this->giveDomain()->giveElement(this->masterElement) ) ) {
        OOFEM_ERROR("Requested element %d doesn't exist.", this->masterElement);
    }
    if ( !( fei = e->giveInterpolation() ) ) {
        OOFEM_ERROR("Requested element %d doesn't have a interpolator.", this->masterElement);
    }

    if ( lcoords.giveSize() == 0 ) { // we don't need to do this again if the spatial localizer was used.
        fei->global2local( lcoords, coordinates, FEIElementGeometryWrapper(e) );
    }

    // Initialize slave dofs (inside check of consistency of receiver and master dof)
    const IntArray &masterNodes = e->giveDofManArray();
    for ( Dof *dof: *this ) {
        SlaveDof *sdof = dynamic_cast< SlaveDof * >(dof);
        if ( sdof ) {
            DofIDItem id = sdof->giveDofID();
            fei = e->giveInterpolation(id);
            if ( !fei ) {
                OOFEM_ERROR("Requested interpolation for dof id %d doesn't exist in element %d.",
                             id, this->masterElement);
            }
#if 0 // This won't work (yet), as it requires some more general FEI classes, or something similar.
            if ( fei->hasMultiField() ) {
                FloatMatrix multiContribution;
                IntArray masterDofIDs, masterNodesDup, dofids;
                fei->evalMultiN(multiContribution, dofids, lcoords, FEIElementGeometryWrapper(e), 0.0);
                masterContribution.flatten(multiContribution);
                masterDofIDs.clear();
                for ( int i = 0; i <= multiContribution.giveNumberOfColumns(); ++i ) {
                    masterDofIDs.followedBy(dofids);
                    masterNodesDup.followedBy(masterNodes);
                }
                sdof->initialize(masterNodesDup, & masterDofIDs, masterContribution);
            } else { }
#else
            // Note: There can be more masterNodes than masterContributions, since all the
            // FEI classes are based on that the first nodes correspond to the simpler/linear interpolation.
            // If this assumption is changed in FEIElementGeometryWrapper + friends,
            // masterNode will also need to be modified for each dof accordingly.
            fei->evalN( masterContribution, lcoords, FEIElementGeometryWrapper(e) );
            sdof->initialize(masterNodes, IntArray(), masterContribution);
#endif
        }
    }
}