本文整理汇总了C++中Dof::setBcId方法的典型用法代码示例。如果您正苦于以下问题:C++ Dof::setBcId方法的具体用法?C++ Dof::setBcId怎么用?C++ Dof::setBcId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dof
的用法示例。
在下文中一共展示了Dof::setBcId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solveYourselfAt
void IncrementalLinearStatic :: solveYourselfAt(TimeStep *tStep)
{
Domain *d = this->giveDomain(1);
// Creates system of governing eq's and solves them at given time step
// >>> beginning PH
// The following piece of code updates assignment of boundary conditions to dofs
// (this allows to have multiple boundary conditions assigned to one dof
// which can be arbitrarily turned on and off in time)
// Almost the entire section has been copied from domain.C
std :: vector< std :: map< int, int > > dof_bc( d->giveNumberOfDofManagers() );
for ( int i = 1; i <= d->giveNumberOfBoundaryConditions(); ++i ) {
GeneralBoundaryCondition *gbc = d->giveBc(i);
if ( gbc->isImposed(tStep) ) {
if ( gbc->giveSetNumber() > 0 ) { ///@todo This will eventually not be optional.
// Loop over nodes in set and store the bc number in each dof.
Set *set = d->giveSet( gbc->giveSetNumber() );
ActiveBoundaryCondition *active_bc = dynamic_cast< ActiveBoundaryCondition * >(gbc);
BoundaryCondition *bc = dynamic_cast< BoundaryCondition * >(gbc);
if ( bc || ( active_bc && active_bc->requiresActiveDofs() ) ) {
const IntArray &appliedDofs = gbc->giveDofIDs();
const IntArray &nodes = set->giveNodeList();
for ( int inode = 1; inode <= nodes.giveSize(); ++inode ) {
for ( int idof = 1; idof <= appliedDofs.giveSize(); ++idof ) {
if ( dof_bc [ nodes.at(inode) - 1 ].find( appliedDofs.at(idof) ) == dof_bc [ nodes.at(inode) - 1 ].end() ) {
// is empty
dof_bc [ nodes.at(inode) - 1 ] [ appliedDofs.at(idof) ] = i;
DofManager * dofman = d->giveDofManager( nodes.at(inode) );
Dof * dof = dofman->giveDofWithID( appliedDofs.at(idof) );
dof->setBcId(i);
} else {
// another bc has been already prescribed at this time step to this dof
OOFEM_WARNING("More than one boundary condition assigned at time %f to node %d dof %d. Considering boundary condition %d", tStep->giveTargetTime(), nodes.at(inode), appliedDofs.at(idof), dof_bc [ nodes.at(inode) - 1 ] [appliedDofs.at(idof)] );
}
}
}
}
}
}
}
// to get proper number of equations
this->forceEquationNumbering();
// <<< end PH
// Initiates the total displacement to zero.
if ( tStep->isTheFirstStep() ) {
for ( auto &dofman : d->giveDofManagers() ) {
for ( Dof *dof: *dofman ) {
dof->updateUnknownsDictionary(tStep->givePreviousStep(), VM_Total, 0.);
dof->updateUnknownsDictionary(tStep, VM_Total, 0.);
}
}
for ( auto &bc : d->giveBcs() ) {
ActiveBoundaryCondition *abc;
if ( ( abc = dynamic_cast< ActiveBoundaryCondition * >(bc.get()) ) ) {
int ndman = abc->giveNumberOfInternalDofManagers();
for ( int i = 1; i <= ndman; i++ ) {
DofManager *dofman = abc->giveInternalDofManager(i);
for ( Dof *dof: *dofman ) {
dof->updateUnknownsDictionary(tStep->givePreviousStep(), VM_Total, 0.);
dof->updateUnknownsDictionary(tStep, VM_Total, 0.);
}
}
}
}
}
// Apply dirichlet b.c's on total values
for ( auto &dofman : d->giveDofManagers() ) {
for ( Dof *dof: *dofman ) {
double tot = dof->giveUnknown( VM_Total, tStep->givePreviousStep() );
if ( dof->hasBc(tStep) ) {
tot += dof->giveBcValue(VM_Incremental, tStep);
}
dof->updateUnknownsDictionary(tStep, VM_Total, tot);
}
}
int neq = this->giveNumberOfDomainEquations( 1, EModelDefaultEquationNumbering() );
#ifdef VERBOSE
OOFEM_LOG_RELEVANT("Solving [step number %8d, time %15e, equations %d]\n", tStep->giveNumber(), tStep->giveTargetTime(), neq);
#endif
//.........这里部分代码省略.........